I am able to parse Json object but not able to parse nested JSON object.I am able to parse upto "base64" (below JSON DATA)but not able to parse then.How can the object within object can be parsed?
JSON Data
{
"StdID":1,
"NAME":"Kirsten Green",
"PHONENO":"095-517-0049",
"DOB":"2009-12-28T00:00:00",
"CLASS":9,
"GENDER":"M",
"ADDRESS":"8254 At Ave",
"NATIONALITY":"Belgium",
"ENROLLEDYEAR":"2016-04-21T00:00:00",
"Photo":null,
"Cat_ID":5,
"base64":null,
"studentDetails":{
"StdID":1,
"GUARDIAN_PHONE_NO":"002-283-4824",
"MOBILE_NO":"1-377-762-8548",
"First_NAME":"Maile",
"Last_Name":"Lancaster",
"Relation":"Father",
"DOB":"2017-02-22T00:00:00",
"Education":"Ph.D",
"Occupation":"Etiam ligula tortor,",
"Income":"20000-30000",
"Email":"urna@sed.ca",
"AddLine1":"Ap #416-4247 Sollicitudin Av.",
"AddLine2":"Ap #801-7380 Imperdiet Avenue",
"State":"ME",
"Country":"Israel"
},
"Marks":null,
"stdCategory":{
"Cat_ID":5,
"Category":"Normal"
}
}
Home class
public void makeJsonObjectRequest(int stud_id) {
String URL = Navigation_URL + stud_id;
Log.d("TAG", "URL:" + URL);
StringRequest stringRequest = new StringRequest(Request.Method.GET, URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response);
studentInformation = new StudentInformation();
studentInformation.StdID = String.valueOf(jsonObject.get("StdID"));
studentInformation.Name = jsonObject.getString("NAME");
studentInformation.Gender = (String) jsonObject.get("GENDER");
studentInformation.Phonenumber = String.valueOf(jsonObject.get("PHONENO"));
studentInformation.StudentClass = String.valueOf(jsonObject.get("CLASS"));
studentInformation.Enrolled_Year = String.valueOf(jsonObject.get("ENROLLEDYEAR"));
studentInformation.Address = String.valueOf(jsonObject.get("ADDRESS"));
studentInformation.DOB = String.valueOf(jsonObject.get("DOB"));
studentInformation.Nationality = String.valueOf(jsonObject.get("NATIONALITY"));
profilename.setText(studentInformation.Name);
} catch (JSONException e) {
Toast.makeText(getApplicationContext(), "Fetch failed!", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(Home.this, error.toString(), Toast.LENGTH_LONG).show();
}
});
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
how can nested json be parsed?