What is the difference between YAML and JSON? When to prefer one over the other - Stack Overflow
Technically YAML is a superset of JSON. This means that, in theory at least, a YAML parser can understand JSON, but not necessarily the other way around.
See the official specs, in the section entitled "YAML: Relation to JSON".
In general, there are certain things I like about YAML that are not available in JSON.
- As @jdupont pointed out, YAML is visually easier to look at. In fact the YAML homepage is itself valid YAML, yet it is easy for a human to read.
- YAML has the ability to reference other items within a YAML file using "anchors." Thus it can handle relational information as one might find in a MySQL database.
- YAML is more robust about embedding other serialization formats such as JSON or XML within a YAML file.
Read full article from What is the difference between YAML and JSON? When to prefer one over the other - Stack Overflow
No comments:
Post a Comment