JSON to YAML Converter
Convert JSON into clean, human-readable YAML for config files.
Was this tool helpful?
Thanks for the feedback!
Paste JSON and this converter rewrites it as YAML, the indentation-based format used by Docker Compose, Kubernetes manifests, GitHub Actions workflows and many application config files. It helps developers who have data or settings in JSON and need an equivalent YAML file that people can read and edit comfortably.
Example
Input:
{"name": "app", "ports": [80, 443], "debug": false}
Output after clicking Convert to YAML:
name: app ports: - 80 - 443 debug: false
Braces, brackets and most quotes disappear; nesting is shown by two-space indentation and list items by a leading dash.
How values are written
- Numbers, true, false and null are written plainly.
- Most strings are written without quotes, like
name: app. - Strings that could be misread are wrapped in double quotes: those containing any of
: # { } [ ] , & * ! | > ' " % @or a backtick, those starting with-,?or:, those with leading or trailing spaces, and the words true, false, null, yes, no, on, off and ~ in any capitalisation. - An empty string becomes
''. - Lists of objects put the dash on its own line with the object's keys indented beneath it. That is valid YAML, though hand-written files often start the first key on the dash line.
The quoting of yes, no, on and off matters because YAML 1.1 parsers, still common, read those words as booleans. The classic example is a country code: country: NO would become false for Norway, so the converter writes country: "NO". A value like nginx:1.27 is quoted too, because of the colon.
Things to check in the output
Strings that look like numbers
A JSON string such as "3.8", "499" or "0123" is written without quotes, so a YAML parser reads it as a number. That changes version strings, prices stored as text and anything with leading zeros; under YAML 1.1 rules, 0123 is even read as an octal number. Add quotes by hand wherever the value must stay a string.
Multi-line strings
A string containing a line break is written with the break as it is, which breaks the YAML structure. Rewrite such values as a YAML block scalar (a | after the key, with the text indented on the following lines).
Nested empty objects and arrays
An empty array or object inside another value does not convert cleanly: an empty array appears as '' and an empty object as "[object Object]". Replace them with [] and {}. Only a completely empty top-level value is written correctly.
Validate before deploying
YAML is strict about indentation and has no braces to catch mistakes, so run the result through the tool that will consume it, such as docker compose config or kubectl apply --dry-run=client, before relying on it. JSON has no comments, so add any explanatory comments (lines starting with #) after converting. If the JSON itself is rejected, the error message comes from the JSON parser; the JSON Validator shows where the problem is. For XML output from the same data, use the JSON to XML Converter. The conversion runs in your browser, so config values such as internal hostnames are not sent anywhere.