The big debate over the winter holidays seems to be people shouting about JSON vs. XML.
Dare Obasanjo has a nice round-up, as well as his own opinions on the matter:
In the past two weeks, I’ve seen three different posts from various XML heavy hitters committing this very sin
- JSON and XML by Tim Bray - This kicked it off and starts off by firing some easily refutable allegations about the extensibility and unicode capabilities of JSON as a general data transfer format.
- Tim Bray on JSON and XML by Don Box - Refutes the allegations by Tim Bray above but still misses the point.
- All markup ends up looking like XML by David Megginson - argues that XML is just like JSON except with the former we use angle brackets and in the latter we use curly braces + square brackets. Thus they are “Turing” equivalent. Academically interesting but not terribly useful information if you are a Web developer trying to get things done.
This is my plea to you, if you are an XML guru and you aren’t sure why JSON seems to have come out of nowhere to threaten your precious XML, go read JSON vs. XML: Browser Security Model and JSON vs. XML: Browser Programming Models then let’s have the discussion.
If you’re too busy to read them, here’s the executive summary. JSON is a better fit for Web services that power Web mashups and AJAX widgets due to the fact that it is essentially serialized Javascript objects which makes it fit better client side scripting which is primarily done in Javascript. That’s it. XML will never fit the bill as well for these scenarios without changes to the existing browser ecosystem which I doubt are forthcoming anytime soon.
Next up: CSV vs. Fixed Width Documents.
Update: Dare’s round-up missed the real instigator of the JSON vs. XML meme: Dave Winer’s blog (here and here). Fun quotes, like this one from Dave:
As Dr Phil asks — What were they thinking?
No doubt I can write a routine to parse this, but look at how deep they went to re-invent, XML itself wasn’t good enough for them, for some reason (I’d love to hear the reason). Who did this [JSON] travesty? Let’s find a tree and string them up. Now.
And Douglas Crockford’s (JSON guy) reply:
I liked the part where Dr Phil said “What were they thinking?” I asked the same question when I first saw XML being proposed as a data format. There were obviously better alternatives.
The good thing about reinventing the wheel is that you can get a round one.
Don’t miss the two different comment threads as well, here and here. Fun times ahead as web service and Web Service APIs continue to collide. - Ben


