tags:

views:

19

answers:

2

Hi all.

I am developing a REST API for my web application for public use.

I am tempted to provide only JSON as format for the response as it is more lightweight than XML (on large traffic, any byte counts).

I think any programming language and platform is able to easily and effectively parse JSON, nowadays.

So, what do you think about providing only JSON and not XML as format for the response?

Thanks,
Dan

A: 

That's pretty much how I work all the time. I found that Google Chrome displays JSON responses out-of-the-box, while XML responses require me to "view source" or cheat using Content-Type: text/plain. I also find JSON very handy when building command-line mini-tools to interact with web/comet servers, message buses, etc., because there is so much less typing and the typing you have to do is so much easier. For instance try timing yourself as you type this on the command line:

sendmsg foobar/queue1 '<msg><labels><rows><row>a</row><row>b</row><row>c</row><row>d</row><row>e</row></rows></labels></msg>'

vs. this:

sendmsg foobar/queue1 '{"labels":["a", "b", "c", "d", "e"]}'
Marcelo Cantos
A: 

Some quantitative data on XML vs JSON here: http://www.slideshare.net/jmusser/pw-glue-conmay2010 (see slide 11)

Eugene Osovetsky