Android Question Json parsing problem on phone but not tablet.

Sam H

Member
Licensed User
Longtime User
I recently used code from :http://www.b4x.com/android/forum/threads/server-online-json-tree-example.39048/

I have got the json parsing working on my tablet (Android Jelly Bean) perfectly, however I just ran it on my phone (Android Gingerbread), and I got the error message:
"java.lang.RuntimeException: JSON Object expected." on the line:

Dim root As Map = Parser.NextObject

Parser is initialised as
"Parser.Initialize(configString)", and the debugger shows that configString is the value I expect it to be.

Any Ideas?

Thanks

Sam
 

DavideV

Active Member
Licensed User
Longtime User
Some reason, I am not getting the error message today, thanks anyway :)
Hi SamH,
i know it's an old thread but i ran into the same problem parsing json on android 2.3.6
After some research i found it's related on how this android version parses json's.
My json's files aren't really 'strictly' to json standard but parsed with the b4j online tool they seem good (and also for android >4)
I solved the problem by preparse my not 'strictly' json with a simple routine that removes all unused/bad chars outside quotes.

Hope this help some others :)
 
Upvote 0
Top