{
"CollegeResponse": {
"departmentDetails": {
"id": 42,
"departmentName": "computer science",
"labDetails": {
"id": 21,
"description": "machine learning",
"assistant": {
"empid": 201101,
"isPermanent": false
}
},
"affilated": false
}
}
}
responseInString = response.getEntity(String.class);
JSONObject json = new JSONObject(responseInString);
String id = json.getJSONObject("CollegeResponse").getJSONObject("departmentDetails").getString("id");
{
"CollegeResponse": {
"departmentD