File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes JSONArray parse error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "JSONArray parse error" Watch "JSONArray parse error" New topic

JSONArray parse error

Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

I have the below json array, i validated it on a json validator and it is correct,

and when my class tries to parse it to an java object, i get the following error,
11-23 09:32:15.928: E/error message(386): A JSONArray text must start with '[' at 1 [character 2 line 1]

any idea why this is caused? i have 5 more functions returning json strings from a web service that work perfectly, just this one doesnt work as it supposed to..

thanks in advance.
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252

Friend it is a JSONObject not JSONArray. Try with JSONObject it will work.
Please tell me if you still face the problem.

Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

yeah figured it out an hour ago after staring the line of code

thanks for the help..
I agree. Here's the link:
subject: JSONArray parse error
It's not a secret anymore!