@Test
public void test04() throws JSONException {
String a="{\"id\":1,\"name\":\"lv\"}";
JSONObject json=new JSONObject(a);
Iterator<String> it = json.keys();
Map<String,Object> map=new HashMap();
while(it.hasNext()){
String key = it.next();
Object value=json.get(key);
map.put(key,value);
}
for(String ob:map.keySet()){
System.out.println(ob+":"+map.get(ob));
}
}
json格式转成Map类型
最新推荐文章于 2022-06-22 23:25:54 发布