Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
zahidalinaqvi
Posts: 445
Registered: ‎10-14-2008
My Device: Blackberry Bold 9000

JSON to XML

How i can convert a JSON string to XML ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks & Regards
Zahid Naqvi | Senior Software Engineer
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: JSON to XML

[ Edited ]

If you are doing this so that you can then use the XML parsers on the BB, then I recommend instead you look for a Java ME JSON parser and get that working for you.

 

I've not done this, but just did a quick Google and there seems to be at least one port around.

New Developer
ennova2005
Posts: 96
Registered: ‎07-26-2008
My Device: Not Specified

Re: JSON to XML

This is what we currently use for a JSON parser and it seems to work  reasonably well

 

http://www.json.org/java/org.json.me.zip

 

We have not benchmarked against the native XML parsers  - sometimes web 2.0 APIs provide both XML and JSON outputs so it would have been interesting to compare the 3rd party JSON parser with the native XML parser.

 

Someone stripped it down even further at 

 

https://launchpad.net/j2me-json

 

(Author's comment: This project is based on the original json.org j2me parser http://www.json.org/java/org.json.me.zip under http://www.json.org/java/index.html. It is a very minimal Json parser. With some major optimisations and cut down in code. It is less extendible but such is the price you pay for smaller size)

 

Here are some other pointers - we did not get around to benchmarking them or testing them for functionality

 

http://stringtree.org/stringtree-json.html and its J2ME port http://www.olivepeak.com/code/

 

RIM should consider putting in a native JSON parser.

Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: JSON to XML

Thanks for these useful links.  I don't have any JSON work ATM, but I'm sure it will happen sooner rather than later!

 

"RIM should consider putting in a native JSON parser."

 

I agree and I believe it is coming.