API Response:
{
"Response": {
"message": "Success",
"url": "http://makemyreport.com/MobileApps/",
"cor": "DEMO",
"headerMsg": "DEMO",
"subheadMsg": "DEMO"
}
}
Asynctask code:
JSONObject jsonObject = new JSONObject(response);
JSONObject responseObj = jsonObject.getJSONObject("Response");
message = responseObj.getString("message");
String url = responseObj.getString("url");
orgId = responseObj.getString("cor");
orgName = responseObj.getString("headerMsg");
String subheadMsg = responseObj.getString("subheadMsg");
log cat error:
Exception: org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
Can anyone help me to solve this problem? Thanks in advance.
response, which is used inJSONObject jsonObject = new JSONObject(response);