Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Org.json.JSONException:字符1834处的未终止字符串_Java_Android_Json - Fatal编程技术网

Java Org.json.JSONException:字符1834处的未终止字符串

Java Org.json.JSONException:字符1834处的未终止字符串,java,android,json,Java,Android,Json,我从webservice获取数据,并将其解析为JSON字符串。 在解析时,我遇到了这个异常:“org.json.JSONException:字符1834处的未终止字符串” 我的密码是 String jsonstring=getJSONString(response); JSONObject json = new JSONObject(jsonstring); 字符串是 [{"LotDescription":"David Weekley homes Traditional Collection

我从webservice获取数据,并将其解析为JSON字符串。 在解析时,我遇到了这个异常:“org.json.JSONException:字符1834处的未终止字符串”

我的密码是

String jsonstring=getJSONString(response);

JSONObject json = new JSONObject(jsonstring);
字符串是

[{"LotDescription":"David Weekley homes Traditional Collection in Baxter Village offers floor plans featuring innovative design and unsurpassed quality. This charming community combines work, play and living, all within the Village. In Baxter Village, you’ll enjoy:  Parks, playgrounds"}]
它一直解析到单词“Village”,在解析“youll”时引发异常,而“youll”似乎是一些HTML内容


此问题的解决方案是什么?

您需要添加字符
\

[{"LotDescription":\"David Weekley homes Traditional Collection in Baxter Village offers floor plans featuring innovative design and unsurpassed quality. This charming community combines work, play and living, all within the Village. In Baxter Village, you’ll enjoy:  Parks, playgrounds\"}]

这样就可以了。

您的Json不是一个
JSONObject
,而是一个
JSONArray

请尝试以下方法:

JSONArray jObject = new JSONArray(jsonstring);
        for (int i = 0; i < jObject.length(); i++) {
             JSONObject object = jObject.getJSONObject(i);

             String LotDescription = menuObject.getString("LotDescription");
         }
JSONArray jObject=新的JSONArray(jsonstring);
对于(int i=0;i
你为什么不试着分析一下自己?至少尝试检查和调试。每次我们都不会用勺子喂你。@Paresh!!谢谢你的建议!!请不要介意!!我没有足够的时间这么做,我落后于这么多的功能和要求,而且我也是android的新手;为什么要逃避这句话?start++是一个不可忽视的错误。谢谢你指出这一点。