views:

131

answers:

1

I'm starting to develop an application for Google Android and heavily relying on a web API that can deliver data in a restful way via json or xml. I now have to decide which library to choose.

I saw that google includes org.json classes in the API but haven't tested them yet.

How are your experiences? What library/API should I use and why?

+1  A: 

If you're mostly aiming for an internal API that is simply a link between servers you control and a client you're creating, I'd highly recommend JSON - it's far more concise in most cases, thus minimizing the data transfer necessary.

Parsing JSON with org.json is as straightforward as passing the JSON string to the constructor of JSONObject, and then using the appropriate type get-methods on each of your expected attributes.

Amber
Is the simplicity json gives you more useful for generating the web back end or for the handset? The most important thing for me is to write the android client in a very fast and simple way. The back end offers both already
Janusz
Well, the argument I was mostly making didn't have to do with either, but more the data link in between; however JSON can be nice and straightforward to parse and use (though there are some nice XML libraries too). In general, for known formats JSON will most likely be slightly faster to parse simply due to its conciseness, but in all but the most data-intensive apps this probably won't be a noticeable difference in speed.
Amber
I'm now using Json and playing arround with google-gson for parsing
Janusz