JSON to YAML
Convert JSON to readable YAML with 2 or 4 space indent and optional key sorting. Quotes values that could be misread. Free, in your browser.
About JSON to YAML
JSON to YAML rewrites JSON as YAML, which is far easier to read and edit by hand. Ideal for Kubernetes, Docker Compose and CI files built from API output.
Indent and order
Pick 2 or 4 spaces, and tick Sort keys alphabetically for tidy, easy-to-compare files.
Safe quoting
Values that some programs could misread, such as yes, no, n and 007, are put in quotes, so they stay strings everywhere.
Long numbers
Very long integers lose precision because JSON numbers are read as ordinary decimals. Keep such IDs as strings in your JSON.
Clear errors
Invalid JSON, such as a trailing comma, shows the browser's message and position.
Private
Everything happens in your browser. Nothing is uploaded.
How to use JSON to YAML
- Paste your JSON or open a file.
- Choose 2 or 4 spaces and tick Sort keys alphabetically if wanted.
- Press Convert.
- Copy the YAML or download the .yaml file.
Help & FAQ
What does JSON to YAML do?
It converts JSON text or a file to YAML with two or four space indentation and optional key sorting.
Why was the key n written as 'n'?
Older YAML 1.1 parsers can read a bare n as false, so the tool quotes it. The same is done for y, yes and no.
Why is 007 in quotes?
It is a string in the JSON. Without quotes YAML could read it as a number and lose the leading zeros.
How are empty lists and objects written?
As [] and {} on the same line as the key, for example k: [] and e: {}.
Can it sort the keys?
Yes. Tick Sort keys alphabetically and keys are ordered at every level, for example a before b and c before d.
Why did a large number change?
JSON numbers are read as ordinary doubles, so 12345678901234567890 became 12345678901234567000. Use a string for exact values.
What happens with invalid JSON?
The tool shows Invalid JSON with the reason and position, for example a trailing comma error, and gives no result.
Are comments possible?
No. JSON has no comments, so the YAML has none either. You can add them afterwards.
Does it handle top-level arrays?
Yes. In the test an array of a number, a string, an object and a list became a YAML list with matching items.
What indent options exist?
Two spaces or four spaces. The list items and nested mappings follow the chosen width.
Is our JSON uploaded?
No. It is converted in your browser and is not sent to a server.