The response from retrofit2 may be of the following types.(and we don\'t know before hand which response will come)
{ \"id\": \"abc\", \"place\": \"LA\",
Try this
JSONObject jsonObject = new JSONObject("your Response String"); Object obj = jsonObject.get("driverId"); //handle Exceptions if (obj instanceof String){ //do String stuff } else if (obj instanceof JSONObject) { //do json object stuff }