YAML ⇄ JSON
Paste YAML to get JSON, or JSON to get YAML. Syntax errors point to the exact line and column, and multi-document files are handled.
How the conversion works
YAML is parsed with js-yaml 4.1, a widely used YAML 1.2 parser, loaded from a public CDN. Your data is still processed entirely in your browser. Anchors and aliases (&defaults, *defaults) and merge keys (<<:) are expanded, comments are dropped, and block strings (| and >) become ordinary JSON strings.
A file with several documents separated by --- becomes a JSON array with one item per document. Going from JSON to YAML, long strings are never folded, so the output round-trips cleanly.
When the input has a syntax error, the message shows the line and column, a few lines of context with a caret under the problem, and a button that jumps the cursor there.
Questions
Is JSON valid YAML?
Almost always. YAML 1.2 was designed as a superset of JSON, so you can paste JSON into the YAML side and it will parse. The reverse is not true: comments, anchors and unquoted strings are YAML-only.
Why did “no” or “on” stay as text?
YAML 1.1 treated yes/no/on/off as booleans, which famously turned the country code NO into false. js-yaml follows YAML 1.2, where only true and false are booleans. Quote values if another tool you use still follows 1.1.
Why does YAML reject my tabs?
The YAML spec does not allow tab characters for indentation. Use spaces instead; the error message points to the first line with a tab.
Are comments kept when converting to JSON?
No. JSON has no comment syntax, so comments are dropped. Converting back to YAML will not restore them.