Hacker News new | ask | show | jobs
by rudian 1678 days ago
You can turn any piece of a YAML into a JSON object and it will be read just as well.

This YAML:

    user:
      name: Ted
is equivalent to this YAML:

    user: {"name": "Ted"}
which is equivalent to this YAML/JSON:

    {"user": {"name": "Ted"}}
2 comments

While true, this is what being a supperset means. What it means is that any JSON document is, without modification, valid YAML document and can be read with a YAML parser.
I think you mean "this isn't what".
That's exactly the case. Any YAML 1.2 parser can parse any valid json document as is.
YAML supports tagged nodes and multiple documents in a stream, which can’t be represented in standard JSON. (You could make up conventions, but only your parser would support them.)