It Had to be Said: XML vs. JSON
James Clark in XML vs. The Web has finally said what needed to be said -- that XML is a singularly bad format for data transmission. Here is the crux of what Mr. Clark had to say:
It's "Yay", because for important use cases JSON is dramatically better than XML. In particular, JSON shines as a programming language-independent representation of typical programming language data structures. This is an incredibly important use case and it would be hard to overstate how appallingly bad XML is for this. The fundamental problem is the mismatch between programming language data structures and the XML element/attribute data model of elements.For me, XML is great at describing documents. XML is also (IMHO) reasonable for describing hierarchies of nodes with attributes (like config files) -- although XML is a little wordy for my tastes when used to describe hierarchies. XML, however (and you knew there had to be a however in there), is a painful format for data transmission. XML's overhead is just way too high for the simple task of transmitting common data structures; for example, the simplest XML representation I can think of for x = 1 is:
which is a total of 16 Unicode characters. In JSON (if I understand the format correctly), x = 1 could be expressed as:
for a grand total of 6 Unicode characters (including the CRLF line ending). Much better.
(James Clark wrote the XSLT spec and came up with the name XML, so his opinion on XML vs. JSON should probably be listened to.
(As a Perl programmer, I was hoping for YAML, but I think the lack of a Java YAML parser for several years led to the triumph of JSON.)