View Full Version : Why so much JSON hype?

02-19-2007, 04:07 AM
John Resig posted his RSS to JSON converter here:


My question is: why is everyone going crazy over JSON?

RSS/XML is great -- why replace it with JSON? What has JSON got that XML hasn't?

(ie. what are the advantages of JSON over XML for the web developer?)

02-19-2007, 07:18 AM
You might want to read about some of the pros and cons here (http://blogs.msdn.com/mikechampion/archive/2006/12/21/the-json-vs-xml-debate-begins-in-earnest.aspx). Interesting reading.

02-19-2007, 08:37 AM
JSON is more domain-specific than XML, and by virtue of that may be better suited for simple data transactions via XMLHttpRequest() than XML. Given that XMLHttpRequest is almost never used to specifically request an XML document (why would you grab an SVG document and import it that way when you could just as easily load it in an iframe?), it makes sense use a better-suited but more limited data-format.

Also, for "AJAX"-related work, in my own library, I send JS objects out, so it makes sense for me to receive JS objects back, rather than an XML document. (Constructing an XML document to send out is more expensive/more difficult than constructing a JS object, explaining my choice.)