Android 解析 嵌套的JsonArray 这个具体该怎么解析呢?
[{"secondId":"29","lessonpId":"20","secondTitle":"教学录像","record":[{"secondId":"29","t...
[
{"secondId":"29","lessonpId":"20","secondTitle":"教学录像",
"record":[{"secondId":"29","threeTitle":"教学录像","threeId":"83"}]
},
{"secondId":"30","lessonpId":"20","secondTitle":"电子教案",
"record":[{"secondId":"30","threeTitle":"第一章","threeId":"59"},
{"secondId":"30","threeTitle":"第二章","threeId":"60"},
{"secondId":"30","threeTitle":"第三章","threeId":"61"},
{"secondId":"30","threeTitle":"第四章","threeId":"62"},
{"secondId":"30","threeTitle":"第五章","threeId":"63"},
{"secondId":"30","threeTitle":"第六章","threeId":"64"}]
},
{"secondId":"31","lessonpId":"20","secondTitle":"多媒体课件",
"record":[{"secondId":"31","threeTitle":"第一章","threeId":"65"},
{"secondId":"31","threeTitle":"第二章","threeId":"66"},
{"secondId":"31","threeTitle":"第三章","threeId":"67"},
{"secondId":"31","threeTitle":"第四章","threeId":"68"},
{"secondId":"31","threeTitle":"第五章","threeId":"69"},
{"secondId":"31","threeTitle":"第六章","threeId":"70"}]
},
{"secondId":"32","lessonpId":"20","secondTitle":"网页课程",
"record":[{"secondId":"32","threeTitle":"课程负责人","threeId":"36"},
{"secondId":"32","threeTitle":"主讲老师","threeId":"37"},
{"secondId":"32","threeTitle":"自我评价","threeId":"38"},
{"secondId":"32","threeTitle":"课程建设规划","threeId":"39"},
{"secondId":"32","threeTitle":"课程录像","threeId":"41"},
{"secondId":"32","threeTitle":"精品课程申报表","threeId":"42"},
{"secondId":"32","threeTitle":"学校政策措施","threeId":"95"}]
},
{"secondId":"53","lessonpId":"20","secondTitle":"教学大纲",
"record":[{"secondId":"53","threeTitle":"教学内容及目标要求","threeId":"54"},
{"secondId":"53","threeTitle":"学时安排与教材","threeId":"55"},
{"secondId":"53","threeTitle":"重点难点及解决方法","threeId":"56"},
{"secondId":"53","threeTitle":"实习安排","threeId":"57"},
{"secondId":"53","threeTitle":"考核方式","threeId":"58"}]
}
] 展开
{"secondId":"29","lessonpId":"20","secondTitle":"教学录像",
"record":[{"secondId":"29","threeTitle":"教学录像","threeId":"83"}]
},
{"secondId":"30","lessonpId":"20","secondTitle":"电子教案",
"record":[{"secondId":"30","threeTitle":"第一章","threeId":"59"},
{"secondId":"30","threeTitle":"第二章","threeId":"60"},
{"secondId":"30","threeTitle":"第三章","threeId":"61"},
{"secondId":"30","threeTitle":"第四章","threeId":"62"},
{"secondId":"30","threeTitle":"第五章","threeId":"63"},
{"secondId":"30","threeTitle":"第六章","threeId":"64"}]
},
{"secondId":"31","lessonpId":"20","secondTitle":"多媒体课件",
"record":[{"secondId":"31","threeTitle":"第一章","threeId":"65"},
{"secondId":"31","threeTitle":"第二章","threeId":"66"},
{"secondId":"31","threeTitle":"第三章","threeId":"67"},
{"secondId":"31","threeTitle":"第四章","threeId":"68"},
{"secondId":"31","threeTitle":"第五章","threeId":"69"},
{"secondId":"31","threeTitle":"第六章","threeId":"70"}]
},
{"secondId":"32","lessonpId":"20","secondTitle":"网页课程",
"record":[{"secondId":"32","threeTitle":"课程负责人","threeId":"36"},
{"secondId":"32","threeTitle":"主讲老师","threeId":"37"},
{"secondId":"32","threeTitle":"自我评价","threeId":"38"},
{"secondId":"32","threeTitle":"课程建设规划","threeId":"39"},
{"secondId":"32","threeTitle":"课程录像","threeId":"41"},
{"secondId":"32","threeTitle":"精品课程申报表","threeId":"42"},
{"secondId":"32","threeTitle":"学校政策措施","threeId":"95"}]
},
{"secondId":"53","lessonpId":"20","secondTitle":"教学大纲",
"record":[{"secondId":"53","threeTitle":"教学内容及目标要求","threeId":"54"},
{"secondId":"53","threeTitle":"学时安排与教材","threeId":"55"},
{"secondId":"53","threeTitle":"重点难点及解决方法","threeId":"56"},
{"secondId":"53","threeTitle":"实习安排","threeId":"57"},
{"secondId":"53","threeTitle":"考核方式","threeId":"58"}]
}
] 展开
展开全部
String json = "";
try {
JSONArray arr = new JSONArray(json);
for (int i=0; i<arr.length(); i++) {
JSONObject obj = arr.getJSONObject(i);
String secondId = obj.getString("secondId");
String lessonpId = obj.getString("lessonpId");
String secondTitle = obj.getString("secondTitle");
JSONArray recordArr = obj.getJSONArray("record");
for (int j=0; j<recordArr.length(); j++) {
JSONObject recordObj = recordArr.getJSONObject(j);
// String secondId2 = recordObj.getString("secondId");
String threeTitle = recordObj.getString("threeTitle");
String threeId = recordObj.getString("threeId");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
try {
JSONArray arr = new JSONArray(json);
for (int i=0; i<arr.length(); i++) {
JSONObject obj = arr.getJSONObject(i);
String secondId = obj.getString("secondId");
String lessonpId = obj.getString("lessonpId");
String secondTitle = obj.getString("secondTitle");
JSONArray recordArr = obj.getJSONArray("record");
for (int j=0; j<recordArr.length(); j++) {
JSONObject recordObj = recordArr.getJSONObject(j);
// String secondId2 = recordObj.getString("secondId");
String threeTitle = recordObj.getString("threeTitle");
String threeId = recordObj.getString("threeId");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
展开全部
完全可以,用activityGroup
追问
能不能说的再详细一些?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用 fastjson
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-10-24 · 知道合伙人教育行家
兰兰老师爱中国
知道合伙人教育行家
向TA提问 私信TA
知道合伙人教育行家
采纳数:23343
获赞数:49015
1975年9月毕业东北电力大学1978年9月牡丹江电力技术学校讲师,1991年6月大连金州热电有限公司高级工程师。
向TA提问 私信TA
关注
展开全部
答-还是您自己算吧对您今后有好处的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询