Org.json.JSONException: Unterminated string at character 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"

my code is,

String jsonstring=getJSONString(response);

JSONObject json = new JSONObject(jsonstring);

The string is,

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

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?


You need to add character .

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

This will do.


Your Json is not an JSONObject but a JSONArray .
Try this instead:

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

             String LotDescription = menuObject.getString("LotDescription");
         }
链接地址: http://www.djcxy.com/p/71612.html

上一篇: 具有独立于泛型类型的泛型方法的原始类型

下一篇: Org.json.JSONException:字符1834处未终止的字符串