I have a strange json string that i receive from rest api, now I am trying to extract info from json string which looks like this.
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
}]
}};
I am trying to read this json like this but dont know how should I iterate over the value under student and employye
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();
}
Thanks