title: Why is JSON replacing XML as a data format?
body: <p>When I first saw XML, I thought it was basically a representation of trees.  Then I thought: the important thing isn't that it's a particularly <em>good</em> representation of trees, but that it is one that everyone agrees on.  Just like ASCII.  And once established, it's hard to displace due to network effects.  The new alternative would have to be much better (maybe 10 times better) to displace it. Of course, ASCII has been (mostly) replaced by Unicode, for internationalization. </p>
  
  <p>According to <a href="http://www.google.com/trends?q=xml%2Cjson&amp;ctab=0&amp;geo=all&amp;date=all&amp;sort=1" rel="nofollow noreferrer">google trends</a>, XML has a x43 lead, but is declining - while JSON grows.</p>
  
  <p>[<em>edited</em>] How and why will JSON replace XML as a data format?</p>
  
  <ol>
  <li>for which tasks?</li>
  <li>for which programmers/industries?</li>
  </ol>
  
  <hr>
  
  <p><em>NOTES:</em>
  S-expressions (from lisp) are another representation of trees, but which has not gained mainstream adoption.  There are many, many other proposals, such as YAML and Protocol Buffers (for binary formats).</p>
  
  <p>I can see JSON dominating the space of communicating with client-side AJAX (AJAJ?), and this possibly could back-spread into other systems transitively.</p>
  
  <p>XML, being based on SGML, is better than JSON as a <em>document format</em>.  I'm interested in XML as a <em>data format</em>.</p>
  
  <p>XML has an established ecosystem that JSON lacks, especially ways of defining formats (XML Schema) and transforming them (XSLT).  XML also has many other standards, esp for web services - but their weight and complexity can arguably count against XML, and make people want a fresh start (similar to "web services" beginning as a fresh start over CORBA).</p>
  
  <p>[<em>edited Mar2010</em>] Like NoSQL, JSON is <em>schemaless</em>.</p>