Monday, November 21st, 2005

JSON == YAML? It’s getting closer to truth

Category: Editorial

Why the lucky stiff is talking about the JSON and YAML camps coming together.

Why made the linkage that JSON and YAML are quite similar, and an amazing thing happened.

Normally if tech X and tech Y were similar what would happen?

Leader A would want to make it more different to distinguish it! And, Leader B would try to do the same thing.

“Hmm should I call this package or namespace? Let’s use namespace to be different”.

Douglas Crockford, the founder of JSON has removed /* .. */ comments from the JSON specification, which was identified as the singular incompatibility between JSON and YAML. In addition, single-quoted strings were removed which YAML handled differently (in terms of escaping.) So, this is good for unifying the two.

It would be great if we could unify these beasts. We aren’t quite their yet though :(

However, another minor difference has been found. In JSON structures, the colon and comma need not be spaced out between items in a collection. In YAML, they do. Observe:

 # valid JSON, also valid YAML
 {"nick": "Philarp Tremaine", "rank": "infantry", 
  "badge": "orange-striped, syrup-scented"}

 # valid JSON, not valid YAML
 {"nick":"Philarp Tremaine","rank":"infantry", 
  "badge":"orange-striped, syrup-scented"}

YAML requires the space after each colon or comma. This is because YAML supports commas and colons in plain, unquoted strings.

 # valid YAML, not valid JSON
 {nick: Philarp Tremain, walked: 1,000 miles,

For now, if you’re using Syck to parse JSON, be sure the JSON outputter you’re using is YAML-safe JSON. Clark and Doug are working to find a middle-ground and the spotlight is on YAML’s buzzer finger right now. I’ll let ya know how it goes.

Posted by Dion Almaer at 12:01 am

3.8 rating from 12 votes


Comments feed

No YAML tags on this site and I suspect none on most of the sites I watch. Google was kind enough to explain the acronym (“Yet another markup language”) and point me at for a definition:

YAML(tm) (rhymes with “camel”) is a straightforward machine parsable data serialization format designed for human readability and interaction with scripting languages such as Perl and Python. YAML is optimized for data serialization, configuration settings, log files, Internet messaging and filtering.

Okay, so what? I hate to be harsh, because this is a really cool example of project teams (apparently the JSON one in this case) working to make programmer’s lives easier. While that’s cool, the article doesn’t ‘splain what difference this is going to make in my work.

Comment by Tim Wood — November 21, 2005


You are right. YAML originally took off in the Ruby community as a better XML (for some things. right tool for the job).

If you think about all of the formats that you have to deal with there are tons.

More frameworks are using YAML these days. A lot more frameworks are using JSON as a way to pass things around (so much faster than XML).

If these combine, then the tools that we have for one, instantly work for the other (and vince versa).

More interop, better tools. It’s all good.


Comment by Dion Almaer — November 21, 2005

I agree with you.

if different technology can interop or interchangable, the world will be better for us.

Comment by Michael Cheng — November 21, 2005

Oh well,
i thought one of the good things about YAML was that the indentation made it easier to read and so maintain. I had seen so many xml examples where the xml was pretty-printed, yet so many real world xml files that were muged-up into as few lines as they could get away with.

Now I find that correct indentation is optional in YAML too. Oh well…

Comment by Paddy — February 18, 2006

Leave a comment

You must be logged in to post a comment.