I am parsing an array of json elements on android. Following line generates following exception. I've validated the json file on some validation pages and all seems correct. What's wrong?
JSONObject object = new JSONObject(content);
The exception:
org.json.JSONException: Unterminated array at character 21 of {
"info":[
{
"category":"Cocktail",
"text":"Long Island Ice Tea",
"info":"nur am 19. Juni",
"imageUrl":"http://www.google.at/google.png",
"thumbnailUrl":"http://www.google.at/google.png"
},
{
"category":"Grill-Wochen",
"text":"Steak vom Grill 350g",
"info":"AB 16.09.2012",
"imageUrl":"http://www.example.com/example.jpg",
"thumbnailUrl":"http://www.example.com/example_thumb.jpg"
}
]
}
replaceAll("\\n", "")on the json string before passing to theJSONObjectclass. Hope it helps.