Remove the slashes:
String json = {"phonetype":"N95","cat":"WP"};
try {
JSONObject obj = new JSONObject(json);
Log.d("My App", obj.toString());
} catch (Throwable t) {
Log.e("My App", "Could not parse malformed JSON: \"" + json + "\"");
}
Related Contents:
- How do I parse JSON in Android? [duplicate]
- Sending and Parsing JSON Objects in Android [closed]
- How to send a JSON object over Request with Android?
- JSONException: Value of type java.lang.String cannot be converted to JSONObject
- How to send POST request in JSON using HTTPClient in Android?
- How to handle Dynamic JSON in Retrofit?
- Caching images and displaying
- 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
- What does google-services.json really do?
- Android- create JSON Array and JSON Object
- Parse Dynamic Key Json String using Retrofit
- How to parse json string in Android? [duplicate]
- Determine whether JSON is a JSONObject or JSONArray
- org.json.JSON Exception : End of input at character 0
- OkHttp Post Body as JSON
- Reading a json file in Android [closed]
- Error StrictMode$AndroidBlockGuardPolicy.onNetwork [duplicate]
- Lazy download images into gridView
- Populate Listview from JSON
- Parse JSON Array without Key in Android
- “Unparseable date: 1302828677828” trying to deserialize with Gson a millisecond-format date received from server
- Retrofit 2: Get JSON from Response body
- How to Parse a JSON Object In Android
- Using GSON to parse a JSON with dynamic “key” and “value” in android
- Passing data from one activity to another using bundle – not displaying in second activity
- Get JSONArray without array name?
- Error message ‘java.net.SocketException: socket failed: EACCES (Permission denied)’
- convert ArrayList to JSONArray
- How to parse this nested JSON array in android
- Unable to Loop through dynamic json string recursively in android
- How to get response as String using retrofit without using GSON or any other library in android [duplicate]
- Get JSON Data from URL Using Android?
- how to send json object to server using volley in android
- org.json.JSONObject cannot be converted to JSONArray in android
- Getting Header from Response (Retrofit / OkHttp Client)
- How can I add an image file into json object?
- Convert XML to JSON object in Android
- Custom converter for Retrofit 2
- Map View draw directions using google Directions API – decoding polylines
- Using JSON File in Android App Resources
- how to display fetched json data into listview using baseadapter
- Cannot deserialize instance of object out of START_ARRAY token in Spring Webservice
- How can Retrofit 2.0 parse nested JSON object?
- How to parse JSON array without any object in Retrofit?
- JSONArray cannot be converted to JSONObject error
- Android: How to return async JSONObject from method using Volley?
- Trying to fix NetworkOnMainThreadException but gives Toast error
- Getting String Value from Json Object Android
- How to show background bitmap on 2D