나는 이것처럼 보이는 json string에서 정보를 추출하려고하는 나머지 api에서받는 이상한 json 문자열을 가지고있다.android에서 complex json string을 읽는 것
var json={"student":{
"0":[{
"name":"manet",
"marks":114
}],
"1":null,
"2":null,
"4":null,
"5":null,
"6":null,
"7":[{
"name":"Om",
"marks":75
}], "employye": {
"0":[{
"name":"nn",
"value":23
}],
"1":[{"name": "tt",
"value": 67}]
"2":null,
"3":null,
"4":null,
"5":null,
"6":null,
"7":[{
"name":"Om",
"value":75
}]
}};
은 내가 학생에서 값을 반복하는 방법을 알고이 사용자는 당신과 같은 쿼리를 가지고try {
JSONObject reader = new JSONObject(data);
Log.d(TAG, ""+reader.length());
JSONObject student = reader.getJSONObject("student");
Log.d(TAG, "Student Array"+student.getJSONArray("0")); // here is the issue
} catch (JSONException j) {
j.printStackTrace();
}
감사
가능한 중복 [안드로이드에서이 중첩 JSON 배열을 구문 분석하는 방법] (http://stackoverflow.com/questions/17673057/how-to-parse-this-nested-json-array-in-android) – ben75