最好的办法反序列化动态嵌套JSON
问题描述:
我有一个嵌套的JSON它看起来像最好的办法反序列化动态嵌套JSON
{
profiles : {
"mike": "123",
"jack": "456"
}
}
轮廓JSON可以是动态的,即我不知道有多少配置文件/名称将出现在其中。我刚刚收到请求。这可能是2或3或X 在java中我试图
Company.java
public class company {
@JsonProperty("profiles")
Profiles profile;
}
Profiles.java
public class profiles{
JsonObject info;
}
这是不对的。什么是正确的方式来获得嵌套的JSON?
答
public class company {
@JsonProperty("profiles")
Map<String, Integer> profiles;
}
+0
或'Map
'地图' –
shmosel
看到https://stackoverflow.com/a/9829502/2310289 –
,你给不包含数组的JSON样本。你可以给更多的样本来确定哪个参数重复? – Sh4m