如上,list数组里面有3个entity数组,每个entity数组里面都有好多对象。我想要entity数组中各个对象里面的值,该如何解析,另外,3个entity数组在某个Activity中只会用其中一个,也就...
如上,list数组里面有3个entity数组,每个entity数组里面都有好多对象。
我想要entity数组中各个对象里面的值,该如何解析,另外,3个entity数组 在某个Activity中只会用其中一个,也就是说,3个entity数组 对应3个Activity,所以 我要准确的取到我想要的哪个entity!
请用JSONObject 、 JSONArray相关知识解析。
谢谢! 在线等!成功加分
JSONObject object = new JSONObject(json);
JSONObject root = object.getJSONObject("root");
JSONObject data = root.getJSONObject("data");
JSONArray list = data.getJSONArray("list");
for(int i=0; i<list.length(); i++){
JSONObject entityObj = list.getJSONObject(i);
JSONArray entitys = entityObj.getJSONArray("entity");
for(int j=0; j<entitys.length(); j++){
JSONObject entity = entitys.getJSONObject(j);
String date = entity.getString("取消日期");
}
}
引入jar,替换你的json直接可运行