YAML and JSON Converter
Convert YAML to JSON and back, with clear errors for the indentation mistakes YAML is famous for.
Processed on your device — no upload
YAML errors report the line, which is nearly always the real problem — a tab where spaces were expected, or a key indented one space too far.
How to use it
- Choose a direction.
- Paste your config, or choose a file.
- Copy the converted result.
How it works
The two formats describe the same shapes — mappings, sequences and scalars — so conversion is a parse in one and a serialisation in the other. What differs is what each format tolerates.
YAML uses indentation for structure, and only spaces. A tab is a syntax error, not a wide space, which is the single most common YAML failure and the one editors hide by rendering tabs as spaces. Errors here report the line, because the line is almost always the answer.
Some strings need quoting and it is not obvious which. yes, no, on and off are booleans in YAML 1.1, so a country code of NO becomes false. A version written as 1.10 becomes the number 1.1. Converting to JSON and back is a quick way to see what your YAML actually means as opposed to what it looks like.
Going the other way, anchors and aliases — YAML's reuse mechanism — are expanded, because JSON has no way to express a reference. The data is identical; the file is longer.
A worked example
Press Load a sample YAML: a Docker Compose file, which is where most people meet YAML.
Converted to JSON, the structure becomes explicit — every mapping in braces, every sequence in brackets. This is the fastest way to check what your indentation actually produced. A key you believed was nested under web appearing at the top level of the JSON tells you it was indented one space too few, and points at the exact line.
Now the quoting trap. Add a line reading enabled: yes and convert. In JSON it comes back as true, not "yes". If that value is a country code or a user's answer, YAML has silently changed it. Quote it — enabled: "yes" — and it stays a string.
The reverse direction is useful for generating configuration. Write or fetch the settings as JSON, convert to YAML, and paste it into a Compose file or a Kubernetes manifest with the indentation already correct.
If the JSON side needs tidying first, the formatter reports the exact line and column of any syntax error.
Questions
Is my config uploaded?
No. Both directions run in your browser — which matters, since config files routinely contain hostnames, credentials and infrastructure details.
Why does YAML reject my tab characters?
Because the specification forbids tabs for indentation. Configure your editor to insert spaces in .yml files; this is the most common YAML error there is.
Why did my "yes" become true?
YAML 1.1 treats yes, no, on and off as booleans. Quote the value if you mean the word. This is what turns the country code NO into false.
What happens to comments?
They are lost. JSON has no comment syntax, so converting to JSON and back does not bring them with it.
What happens to anchors and aliases?
They are expanded, since JSON cannot express a reference. The data is the same; the file is longer.
Which is better for configuration?
YAML is easier to read and write by hand and supports comments. JSON is unambiguous and has no type surprises. Most tools accept both.
Can it handle multi-document YAML?
Only the first document. Files separated by --- need to be split before converting.
How do I find the error in a large YAML file?
The message includes the line number. It is nearly always an indentation mistake or a tab, both of which are invisible in most editors.