Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

JSONArray parse error

 
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have the below json array, i validated it on a json validator and it is correct,
{"OikExodaID":22829,"KAAnam":0,"KAFinal":205000,"KADap":205000,"KAEntal":155640.6,"KAPliroth":155640.6,"KATimol":0,"DSum":155640.6,"AdiathPistosi":0,"SumParaDapanis":155640.6,"DiathParaDap":49359.4,"UpoloipoEntalm":0.0,"Anexoflita":0.0}

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.
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah figured it out an hour ago after staring the line of code

thanks for the help..
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic