I have an application that performs a little slow over the internet due to bandwidth reasons. I have enabled GZip which has improved download time by a significant amout, bu
"person":{"firstname":"Fred",
"lastname":"Flintstone",
"age":38,
"spouse":"Wilma" }
XML: 80 chars
JSON: 92 chars.
XML is the 13% slimmer winner, who would have thought for all the bogus claims?
[Example taken from Cheeso above. Note that carriage return types change the size but equally for both. Without any returns in either, the ratio is XML: 74, JSON: 86, a 14% difference]
Someone claimed in this discussion that "using attributes for content is cheating" (citing [this][1]).
1) Pray tell how well formed XML is 'cheating'? If it doesn't cheat the (very long) spec, then let's please get over it. Valid is valid.
2) In that case an ASP.NET web.config is 'cheating', among a thousand other big-dog examples.
To be fair, there are those who tend to have a bloated-XML mentality in how they form the XML.
But it should not be said that the 13% slimmer XML variety is not just as valid. And thus it even beats JSON (in size).
[1]: http://www.ibm.com/developerworks/xml/library/x-eleatt/index.html [2004 article, mind you]