JSON and YAML side by side
YAML 1.2 is a superset of JSON, so every JSON document has an exact YAML equivalent. YAML drops the braces, brackets and most quotes and uses indentation instead, which is why it's the usual format for configuration files.
| JSON | YAML |
|---|---|
{"name": "web"} | name: web |
["a", "b"] | - a- b |
null | null (or ~) |
Things to know
- Strings that YAML could misread —
"yes","no","1.0", or text starting with:or#— are quoted automatically. - YAML is indentation-sensitive: always use spaces, never tabs.
- Comments (
#) are allowed in YAML but not in JSON, so converting back drops them.


