86403969 2020-01-04
String jsonstr = "[{\"id\":\"123\",\"name\":\"张三\",\"age\":\"11\"},{\"id\":\"321\", \"name\":\"李四\",\"age\":\"21\"}]"; JSONArray jsonArray = JSONArray.parseArray(jsonstr); for (int i=0;i<jsonArray.size();i++) {//会循环两次 JSONObject jsonObject = jsonArray.getJSONObject(i); String id = jsonObject.getString("id");//123,321 String name = jsonObject.getString("name");//张三,李四 String age = jsonObject.getString("age");//11,21 }