So long XML, welcome Json!

There was a time, some years ago, when, thanks to the then-young HTML, the markup idea with angular parenthesis was considered cool. It wasn’t infrequent to <humor> abuse it </humor> everywhere. Then, as every trend does, it went out of fashion and markup is no longer considered trendy. For bad or good we have some legacies from those days, the most notable is XML.
Xml originated from a good idea – standardize a way to describe complex data. Also Xml has a great plus, if you do everything right, you may be able to validate that an Xml description is compliant with your definition. In other words you may check if that 3d scene you are loading is really a 3d scene and not something else or something garbled up.
Beside of these good intentions I never felt at ease with Xml. First I found it very verbose, although you can write it by hand, you surely don’t want to – it’s too easy to lose some closing statement and you are likely to continuously lookup the specification to check whether that data is data or attribute.
Moreover it’s not straightforward to parse an XML file. Likely you have to employ an existing library (there are dozens for each language) and learn it.
When confronted with Xml I always thought there should be a better way to store something in a structured way. Someway it could be more readable, more writable and that doesn’t require too much brain power to write parser and interprets.
In some occasions I figured out a sort of pseudo C with braces to group values and so on.
Some time ago a coworker pointed me to json which, in fact, is a simple standard for structured data that comes from Javascript notation. Json files are easy to write and read for a human being, and writing a C parser for this format requires a couple of evenings (but if you prefer, you can use a ready made parser).
Btw, as we are in this time of the year, I wish you a Merry Christmas and Happy New Year!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.