YAML to JSON Converter is a free tool that converts YAML documents, such as Kubernetes manifests, Docker Compose files and CI pipelines, into JSON. It also works as a YAML validator: syntax and indentation errors are reported with their exact line and a suggested fix. Everything runs in your browser.
How to convert YAML to JSON
- Paste your YAML or open a
.yaml/.ymlfile. - The JSON appears on the right, pretty-printed or minified.
- If there is an error, click Show to jump to the line.
Common YAML errors
- Tabs: YAML only allows spaces for indentation. Many editors can convert tabs to spaces for you.
- Misaligned items: all keys at the same level must start in exactly the same column.
- Missing space after a colon:
key:valueis read as one string; writekey: value. - Duplicate keys: the same key twice in one block is reported, since one value would silently be lost.
How values are interpreted
The converter follows YAML 1.2, the current version. Only true and false become booleans, so values like yes, no, on and the country code NO stay as text. Older YAML 1.1 tools turn them into booleans, which is a frequent source of bugs.
- Anchors and aliases (
&baseand*base) are expanded into full copies. Their number is limited, so maliciously crafted files can’t exhaust your browser’s memory. - Multiple documents separated by
---become a JSON array. - Comments are dropped, because JSON has no comments.
To convert in the other direction, for example to turn an API response into a configuration file, useJSON to YAML. The JSON Formatter can tidy or minify the result, and JSON Diff compares two versions of a configuration.
Frequently asked questions
Why does my YAML fail to convert?
The most common causes are tabs used for indentation (YAML only allows spaces), items that don’t line up at the same indentation, and a missing space after a colon.
How are yes, no and on handled?
This converter follows YAML 1.2, where only true and false are booleans. yes, no, on and off stay as text, which avoids the “Norway problem” where the country code NO turns into false.
What about anchors and aliases?
They are expanded, so the JSON contains full copies. Aliases are limited to prevent “billion laughs” files from exhausting memory.
What happens with multiple documents?
YAML files containing several documents separated by --- become a JSON array with one item per document.
Last updated