我有一个 Json,如下所示:- { "componentModelData": { "modelNumber": "ABC", "modelName": "", "modelDescription": "", "modelVendor": null, "componentName": "HELO" }, "revisionData": { "revisionName": "rev12", "revisionComment": "Comment", "modifiedBy": "2323553" }, "configData": [{"nodes":2085,"FxPOS-SX":16.5051,"FxPOS-SY":11.0479,"FxPOS-SZ":115.3421,"FxPOS-SXY":-13.8094,"FxPOS-SYZ":36.0105 },{"nodes":2085,"FxPOS-SX":16.5051,"FxPOS-SY":11.0479,"FxPOS-SZ":115.3421,"FxPOS-SXY":-13.8094,"FxPOS-SYZ":36.0105}] }数据映射程序@Getter@Setter@JsonSerialize@NoArgsConstructor@AllArgsConstructorpublic class DataMapping implements Serializable { /** * */ private static final long serialVersionUID = -2635323042843403966L; @JsonProperty("componentModelData") @Valid public ComponentModelDTO componentModelDTO; @JsonProperty("revisionData") @Valid public RevisionDTO revisionDTO; @JsonProperty("configData") private List<Object> configData;}我想将 configData 列表转换为List<HashMap<String,Double>> listString 是像'nodes,FxPOS-SX,FxPOS-SY'这样的键,值是它们各自的值。任何人都可以帮助我如何实现这一目标?
1 回答
明月笑刀无情
TA贡献1828条经验 获得超4个赞
只需替换List<Object>
为List<Map<String,Double>>
. 杰克逊会为你做艰苦的工作:
@JsonProperty("configData") private List<Map<String, Double>> configData;
添加回答
举报
0/150
提交
取消