我有一个JSON,就像下面图片中所示,存储在MYJSON
中--
我的计划是检索所有childObject0
中的对象,并将它们存储在ArrayList
中,以便稍后处理。所以我做了以下操作-
ArrayList<String> childLists = new ArrayList<String>();
try {
JSONArray childArray = MYJSON.getJSONArray("childObject0");
for (int i = 0; i<jArray.length(); i++
) {
//I lost it here! How can I append to `childList` from `childArray`?
}
} catch (JSONException e) {
e.printStackTrace();
}
无法弄清如何添加。这是正确的方法吗?childObject0
是动态的,计数随时更改。谢谢。
ArrayList<JSONObject>
拯救了这一天! - envyM6