Org.json.JSONException:在1834年的字符字符串未结束字符串、字符、结束、json

2023-09-07 23:22:07 作者:告诉自己、要坚强

我从获取Web服务的数据,这我解析为JSON字符串。 在解析我此异常:org.json.JSONException:人品1834年未终止的字符串

I am fetching the data from webservice, which I am parsing to JSON string. While parsing I am this exception: "org.json.JSONException: Unterminated string at character 1834"

我的code是,

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"}]

据分析,直到单词村官​​和提高例外,而解析YOU&rsquo的; LL。这似乎是一些HTML内容

It is parsing till the word "Village" and the raising the exception while parsing " you’ll " which seems to be some HTML content.

,这是什么解决办法吗?

What is the solution for this?

推荐答案

您需要添加字符 \\ 。结果

[{"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\"}]

这会做。