A simpler better alternative to XML

I have never been the biggest fan of XML, certainly I never felt that the reality of it lived up to the hype. It seems I am not the only one, and some people have come up with a simpler, more compact, easier to read alternative called JSON.

By way of comparison, here is some information expressed in XML format:

<menu id="file" value="File" >
<menuitem value="New" onclick="CreateNewDoc()" />
<menuitem value="Open" onclick="OpenDoc()" />
<menuitem value="Close" onclick="CloseDoc()" />

And here is the same thing in JSON:

{"menu": {
"id": "file",
"value": "File:",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}

Ok, so perhaps not a massive difference, but JSON is far easier for a computer to parse, and I think it is slightly easier for a human to understand too.

Leave a Reply

Your email address will not be published.