代码
Map<String,String> map = new HashMap<>();
map.put("aa","aa");
map.put("bb","bb");
map.put("cc","cc");
Map<String,String> ss = new HashMap<>();
ss.put("dd","dd");
ss.put("ee","ee");
ss.put("ff","ff");
NutMap nutMap = new NutMap();
nutMap.setv("itype","1");
nutMap.setv("map",map);
nutMap.setv("ss",ss);
String content = Json.toJson(nutMap);
System.out.println("--------------content="+content);
Map<String,String> map1 = Json.fromJsonAsMap(String.class,content);
System.out.println("--------------"+Json.toJson(map1));
结果:
--------------content={
"itype": "1",
"map": {
"aa": "aa",
"bb": "bb",
"cc": "cc"
},
"ss": {
"dd": "dd",
"ee": "ee",
"ff": "ff"
}
}
--------------{
"itype": "1",
"map": "",
"ss": ""
}
我想取出所有的内容,该怎么写?