String temp = "{‘data‘:{‘a‘:[{‘b1‘:‘bb1‘,‘c1‘:‘cc1‘},{‘b2‘:‘bb2‘,‘c2‘:‘cc2‘}]}}";
JSONObject jodata = JSONObject.fromObject(temp);
JSONObject joa = JSONObject.fromObject(jodata.get("data").toString());
JSONArray ja = JSONArray.fromObject(joa.get("a"));
for (int i = 0; i < ja.size(); i++) {
JSONObject o = ja.getJSONObject(i);
if (o.get("b1") != null) {
System.out.println(o.get("b1"));
}
if (o.get("c1") != null) {
System.out.println(o.get("c1"));
}
if (o.get("b2") != null) {
System.out.println(o.get("b2"));
}
if (o.get("c2") != null) {
System.out.println(o.get("c2"));
}
}
原文:https://www.cnblogs.com/xy888/p/9043578.html