How to Convert JSON to YAML
JSON and YAML describe the same shapes — objects, arrays, and scalars — so converting from JSON to YAML is mostly a matter of style. YAML trades JSON's brackets and quotes for indentation, which is why it's popular for config files people edit by hand.
They model the same data
Every JSON value maps directly to YAML. This JSON:
{
"name": "DevUtilsNow",
"active": true,
"features": ["fast", "private", "free"]
}
becomes this YAML:
name: DevUtilsNow
active: true
features:
- fast
- private
- free
Objects become mappings (key: value), arrays become sequences (- item), and nesting is shown by indentation instead of { } and [ ].
Why some strings get quoted
The one thing to watch is scalars that could be mistaken for another type. In YAML, 123 is a number, true is a boolean, and null is null. So if your JSON has the string "123" or "true", a good converter writes it in quotes so it stays a string when the YAML is parsed back:
zip: "123"
enabled: "true"
Strings containing a colon-space (a: b), a leading #, or leading/trailing spaces are quoted for the same reason. Plain, unambiguous strings are left unquoted for readability.
Block style vs flow style
YAML supports a compact "flow" style ([fast, free]) that looks like JSON, and the indented "block" style shown above. Block style is what most config files use because it's the easiest to read and diff, so that's what this converter produces.
The other direction
Need to go back? See How to Convert YAML to JSON, and for choosing between formats generally, JSON vs XML vs YAML vs CSV.
Try it
Paste JSON and get clean, block-style YAML instantly — everything runs in your browser, nothing uploaded.