Malaika Khan Malaika Khan - 4 months ago 11
Android Question

JSON Cannot viewed in Listview, Getting Error, Unterminated Exceptions

I want to show data in listview and I am getting error. How to Show data in ListView.
THis is my newstring variable

{"JSONDataResult":"{"contacts":[{"country":"Pakistan","sunrise":1381107633,"sunset":1381149604}]}"}


and my error is in this line after this line i got exception in code

JSONObject jsonObj = new JSONObject(newString);


and my error in logcat is

01-15 15:39:17.050: W/System.err(731): org.json.JSONException: Unterminated object at character 22 of {"JSONDataResult":"{"contacts":[{"country":"Pakistan","sunrise":1381107633,"sunset":1381149604}]}"}


Thanks for your help

Answer

valid your JSON, using this you had a lingering "

{
    "JSONDataResult": {
        "contacts": [
            {
                "country": "Pakistan",
                "sunrise": 1381107633,
                "sunset": 1381149604
            }
        ]
    }
}
Comments