5 ms·
Huh, no. YAML is a superset of JSON. So valid JSON is valid YAML. This is sometimes suprisingly useful. Also, YAML is used everywhere and like the other user po
by IceWreck 5y ago
Huh, no. YAML is a superset of JSON. So valid JSON is valid YAML. This is sometimes suprisingly useful. Also, YAML is used everywhere and like the other user pointed out, has mature well tested libs for almost every language.
- imglorp 5y agoAnother JSON superset is HOCON. The H is for human.
- speed_spread 5y agoHOCON is pretty good. Probably the sanest format for config files.
- TedDoesntTalk 5y agoHow is YAML a superset of JSON? never heard that claim before.
- BiteCode_dev 5y agoAny valid json can be parsed by any 1.2 yaml parser. That's how it gained popularity in the first place: you didn't have to migrate. Like ascii and utf8.
- riffraff 5y agoWhen YAML came out there was no large JSON usage to migrate from, the incumbent in configuration was "human readable serialization" was XML.
- rudian 5y agoYou 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"}}
- Spivak 5y agoWhile 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.
- erik_seaberg 5y agoYAML 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.)
- NoThisIsMe 5y agoIt just is: Any valid JSON is valid YAML with the same semantics. It was intentionally designed that way (though not from the start iirc). Basically take JSON, make quotes optional for strings and make curly brackets optional if the object is indented properly, and boom you've got (something like) YAML.
- yuuu 5y agoIf all JSON is YAML but not all YAML is JSON, then YAML is a superset of JSON.
- tuukkah 5y agoIndeed: "YAML version 1.2 is a superset of JSON" https://en.m.wikipedia.org/wiki/JSON#YAML https://en.m.wikipedia.org/wiki/JSON#YAML
- bmn__ 5y ago> YAML is a superset of JSON. That's false. http://p3rl.org/JSON::XS#JSON-and-YAML http://p3rl.org/JSON::XS#JSON-and-YAML