0
쿼리가 있습니다. 아래에서 언급 한 json 응답에서 키 "studentData"아래에 "class"키를 읽어야합니다. {java 코드에서 jsonArray를 사용하여 json 응답을 읽는 방법
"studentData"[ { "이름": "존" "클래스"2 "rollno": "2015" } ] "yearofenrollment"2,017 }
도와주세요. 사전에
감사
쿼리가 있습니다. 아래에서 언급 한 json 응답에서 키 "studentData"아래에 "class"키를 읽어야합니다. {java 코드에서 jsonArray를 사용하여 json 응답을 읽는 방법
"studentData"[ { "이름": "존" "클래스"2 "rollno": "2015" } ] "yearofenrollment"2,017 }
도와주세요. 사전에
감사
JSONObject jsonObjectResponse = new JSONObject(response.toString()); //obtain the object
JSONArray jsonMainNode = jsonObjectResponse.optJSONArray("studentData");//get array from object
JSONObject jsonChildNode = jsonMainNode.getJSONObject(0);//get first object in array
String studentDataValue = jsonChildNode.optString("class");//obtain value from class key