[conspire] YAML, JSON, XML, oh my
Deirdre Saoirse Moen
deirdre at deirdre.net
Thu Jan 9 16:05:48 PST 2020
Rick and I got into a discussion of these three different markup formats over the last few days (due to my post on the list mentioning it, and I thought I’d mention something I’d learned recently.
I was at Silicon Valley Code Camp and went to this talk on the history of JSON: https://www.youtube.com/watch?v=xZdNGfFh5BY <https://www.youtube.com/watch?v=xZdNGfFh5BY>
Douglas Crockford, the JSON codifier, pointed out that XML had essentially vanished in all but legacy enterprise applications. And it’s true, I haven’t seen it mentioned on job listings in years. Only JSON.
In terms of simplicity, YAML > JSON > XML.
What’s interesting is that, despite YAML being a simpler format, as of YAML 1.2, all JSON files are also YAML-compliant. (The reverse is not true.)
I got introduced to YAML with Ruby on Rails and got really into it. You could specify test data like:
name: Forest Keeper
name: Horned Frog
(Note that YAML uses whitespace and indentation as syntactically significant. The names of each record are only used for test purposes and not stored in the db.)
In JSON, this would be:
"name": "Forest Keeper",
"name": "Horned Frog",
Too much shifting and unshifting for those quotes and braces, imho, but usable enough.
XML would be even more verbose and I’m not even gonna go there. It’s a new decade after all.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the conspire