Questions tagged «jsonexception»

8
从字符串到json对象的转换android
我正在开发一个Android应用程序。在我的应用程序中,我必须将字符串转换为Json Object,然后解析值。我检查了stackoverflow中的解决方案,并在此处找到了类似的问题链接 解决方案是这样的 `{"phonetype":"N95","cat":"WP"}` JSONObject jsonObj = new JSONObject("{\"phonetype\":\"N95\",\"cat\":\"WP\"}"); 我在代码中使用相同的方式。我的绳子是 {"ApiInfo":{"description":"userDetails","status":"success"},"userDetails":{"Name":"somename","userName":"value"},"pendingPushDetails":[]} string mystring= mystring.replace("\"", "\\\""); 替换后,我得到了这样的结果 {\"ApiInfo\":{\"description\":\"userDetails\",\"status\":\"success\"},\"userDetails\":{\"Name\":\"Sarath Babu\",\"userName\":\"sarath.babu.sarath babu\",\"Token\":\"ZIhvXsZlKCNL6Xj9OPIOOz3FlGta9g\",\"userId\":\"118\"},\"pendingPushDetails\":[]} 当我执行 JSONObject jsonObj = new JSONObject(mybizData); 我收到以下json异常 org.json.JSONException: Expected literal value at character 1 of 请帮助我解决我的问题。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.