android JSONArray JSONObject 字符串转json数组 遍历json对象

String json = "{''data'':[{''name'':''Wallace''},{''name'':''Grommit''}]}";
StringBuffer marketXml = new StringBuffer(); jsonObjSplit = new JSONObject(json );
JSONArray ja = jsonObjSplit.getJSONArray("data'");
for (int i = ; i < ja.length(); i++) {
JSONObject jo = (JSONObject) ja.get(i); marketXml.append(jo.get(''name'"));
System.out.println(marketXml.toString());
}
-------------------------------------------------------------------------遍历json 对象 jsonObj = new JSONObject(activeMarketRet); for (Iterator iter = jsonObj.keys(); iter.hasNext();) { //先遍历整个 people 对象
String key = (String)iter.next();
System.out.println(jsonObj .getString(Key));
上一篇:Castle.ActiveRecord (V3.0.0.130)


下一篇:vs code 配置spring boot开发环境