[conspire] YAML, JSON, XML, oh my

Josef Grosch jgrosch at gmail.com
Fri Jan 10 08:52:04 PST 2020


XML is mostly gone except it is used in Maven and Tomcat. XML is verbose
but it's one advantage over json and yaml is that you can embed comments in
the file. I prefer json over yaml for the same complaint I have with
Python, the lack of real block delimiters. I really like the fact that
their are json beautifiers which also catch mistakes in the json file.

cat random-file.json | python -m json.tool



Josef

On Thu, Jan 9, 2020 at 4:09 PM Deirdre Saoirse Moen <deirdre at deirdre.net>
wrote:

> 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
>
> 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:
>
> uno:
>   id: 1
>   name: Forest Keeper
>   speed:  88
> dos:
>   id: 2
>   name: Ghost
>   speed:  101
> tres:
>   id: 3
>   name: Horned Frog
>   speed:  100
>
> (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:
>
> {"monsters":[
>   {"id": 1,
>   "name": "Forest Keeper",
>   "speed":  88},
>   {"id": 2,
>   "name": "Ghost",
>   "speed":  101},
>   {"id": 3,
>   "name": "Horned Frog",
>   "speed":  100}
> ]}
>
> 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.
>
> Deirdre
>
> _______________________________________________
> conspire mailing list
> conspire at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/conspire
>


-- 
Josef Grosch             |   Berkeley, CA.           |  Where ever you go,
Jgrosch at gmail.com <Jgrosch at ebay.com>  |   Cell: 510-207-9976  |  There you
are
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://linuxmafia.com/pipermail/conspire/attachments/20200110/eb2dc0e5/attachment.html>


More information about the conspire mailing list