How to fix this error in my logcat...
org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
How to fix this error in my logcat...
org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
your string which is logged in the clip is in HTML format, not JSON.
https://developer.android.com/reference/org/json/JSONObject.html
JSONObject jobj = new JSONObject();
try {
jobj = new JSONObject(string);
} catch (JSONException e) {
//e.printStackTrace();
}
will give you a json object if your input is in correct json format
try {
JSONObject jsonObject = new JSONObject(YOUR_STRING);
}
catch (JSONException e) {
e.printStackTrace();
}