How to convert JSON to YAML
- Paste your JSON into the left box โ a full object, an array, or a single value.
- Pick 2- or 4-space indentation (2 is the convention for Kubernetes, GitHub Actions and Docker Compose).
- Hit Convert to YAML and copy the result.
What the converter does with quoting
YAML only needs quotes when a value could be misread. This converter quotes a string when it looks like a number, a boolean, null, a date, or when it starts with a character YAML treats specially โ so "yes", "1.0" and "*ref" stay strings instead of silently becoming a boolean, a float or an alias. Plain words are left unquoted so the output reads like YAML a human wrote.
Empty objects, arrays and nesting
An empty object is written as {} and an empty array as [], because YAML has no indented way to express "nothing here". Nested arrays of objects use the standard dash-plus-key form that Kubernetes manifests use. Multi-line strings are emitted as literal block scalars so newlines survive the round trip.
Privacy matters here more than usual
Config files are exactly the kind of thing that carries API keys, connection strings and internal hostnames. Most online converters send your input to a server. This one never makes a network request at all โ the conversion is JavaScript running on your own device, which you can verify by opening your browser's network tab while you use it.
Benefits
- Converts nested objects and arrays into properly indented YAML with 2- or 4-space indentation.
- Quotes strings only where YAML would otherwise misread them, so "1.0" and "yes" stay strings.
- Multi-line strings become literal block scalars, so newlines survive the conversion.
- Nothing is uploaded โ safe for config files that contain keys, hostnames and connection strings.
Limitations to know
- JSON has no comments, so the YAML output has none to carry over.
- It does not generate anchors or aliases; repeated structures are written out in full.
- Very large files can briefly freeze the browser tab while the conversion runs.
Common mistakes to avoid
- Assuming an unquoted "no" or "off" stays a string in YAML โ in YAML 1.1 those parse as booleans, which is why this converter quotes them.
- Pasting a JSON fragment rather than a complete document, which fails to parse.
- Treating the generated YAML as the source of truth and then losing the comments you add to it on the next regeneration.
Alternatives
To go the other way, use the YAML to JSON Converter. To tidy or validate the JSON first, use the JSON Formatter, and for XML documents use the XML Formatter.
Last updated: August 2026 ยท Reviewed by the AI Toolbox editorial team.
Frequently asked questions
Does it support comments?
JSON has no comments, so there are none to carry over. Going the other way, our YAML to JSON converter drops comments because JSON cannot hold them.
Will the YAML round-trip back to identical JSON?
Yes for standard data. Use the YAML to JSON converter to check โ the values should match exactly.
Why is my number in quotes?
Because it was a string in the JSON. Quoting keeps it a string in YAML; without quotes, YAML would read it as a number.
Is there a size limit?
Only your browser memory. Files of a few megabytes convert fine; very large files may pause the tab briefly.