Reason is some un-wanted characters was added when you compose the String.
The temp solution is
return new JSONObject(json.substring(json.indexOf("{"), json.lastIndexOf("}") + 1));
But try to remove hidden characters on source String.
More Related Contents:
- Multiple array json parsing under a object in android [closed]
- How to parse this? [closed]
- Sending and Parsing JSON Objects in Android [closed]
- How do I parse JSON in Android? [duplicate]
- How to get response as String using retrofit without using GSON or any other library in android [duplicate]
- JSONArray cannot be converted to JSONObject error
- Getting String Value from Json Object Android
- JSON parsing in android
- Android-change cardview background color parsing json
- Set the JSON Data in TextView?
- Parse HTML in Android
- How to send POST request in JSON using HTTPClient in Android?
- Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
- Simple parse JSON from URL on Android and display in listview
- Error message ‘java.net.SocketException: socket failed: EACCES (Permission denied)’
- How to Parse a JSON Object In Android
- Passing data from one activity to another using bundle – not displaying in second activity
- Get JSONArray without array name?
- Reading a json file in Android [closed]
- org.json.JSONObject cannot be converted to JSONArray in android
- Get JSON Data from URL Using Android?
- How can I add an image file into json object?
- Map View draw directions using google Directions API – decoding polylines
- Android: How to return async JSONObject from method using Volley?
- How to parse JSON array without any object in Retrofit?
- Trying to fix NetworkOnMainThreadException but gives Toast error
- Unable to Loop through dynamic json string recursively in android
- MalformedJsonException with Retrofit API?
- How to handle parameters that can be an ARRAY or OBJECT in Retrofit on Android?
- org.json.JSONException: End of input at character