JSONArrary与JSONObject嵌套解析出错问题
下面是我的解析过程:
public static Douban resolveJson(String jsonStr) throws JSONException {
Douban douban = new Douban();
JSONObject jsonObject = new JSONObject(jsonStr);
int count = jsonObject.getInt("count");
int total = jsonObject.getInt("total");
if (count != 100 || total == 0) {
douban = null;
return douban;
}
douban.setCount(count);
douban.setTotal(total);
JSONArray jsonSubjects = jsonObject.getJSONArray("subjects");
List<Subjects> subjectsList = new ArrayList<>();
for (int i = 0; i < jsonSubjects.length(); i++) {
JSONObject jsonSubjectsJSONObject = jsonSubjects.getJSONObject(i);
Subjects subjects = new Subjects();
JSONArray jsonGenres = jsonSubjectsJSONObject.getJSONArray("genres");
List<String> genresList = new ArrayList<>();
for (int j =