JSON ⇄ YAML

Converts JSON to YAML and YAML to JSON, validating both sides with line and column errors.

You can also drag and drop a file here.

YAML indentation

What is YAML

YAML (YAML Ain't Markup Language) is a text format for structured data, designed to be easy for humans to read and write — it uses indentation instead of braces and brackets to show hierarchy. That's why it became the de facto language of infrastructure: docker-compose, GitHub Actions, Kubernetes, and OpenAPI all describe configuration in YAML, while APIs keep exchanging data in JSON — converting between the two is routine work for anyone touching CI/CD.

JSON is (almost) a subset of YAML

Every valid JSON document is also valid YAML — the YAML 1.2 spec was designed that way, to the point of accepting plain JSON as input. That's why YAML → JSON is always possible without data loss (the only real exceptions are comments and anchors/aliases, see below); JSON → YAML never fails either, because YAML can represent everything JSON can, just with a leaner syntax.

The Norway problem

In YAML 1.1, words like yes/no/on/off (in any case) were parsed as booleans — a field like country: NO (Norway's ISO code) silently became country: false, a bug classic enough to earn its own name. YAML 1.2 fixed this: only true/false (in any case) are booleans; yes/no/on/off went back to being plain text. This tool uses YAML 1.2, so country: NO stays the string "NO" — but it's worth knowing that another tool (or an older version of some library) may still behave like YAML 1.1.

Automatic typing — numbers that change shape

Like JSON, YAML tries to recognize the type of an unquoted value: 42 becomes a number, true becomes a boolean. That creates two common pitfalls besides the Norway problem: a value like 1.10 (meant as a version number) becomes the number 1.1, losing the trailing zero; and a value with a leading zero like 007 becomes the number 7, losing the leading zero. Dates and octal numbers, common in other YAML implementations (1.1), don't affect this tool — the "core" schema of YAML 1.2 used here doesn't recognize either format automatically, so both already arrive as plain text. Whenever the exact format matters more than the numeric value — a version, a postal code, a barcode — the output stays predictable by wrapping the value in quotes in the source YAML.

Comments and anchors — what changes on the way to JSON

JSON has no comment syntax — any # in the input YAML is dropped when converting to JSON, and this tool warns whenever that happens, never silently. YAML also has anchors (&name) and aliases (*name), a way to reuse the same value in more than one place without repeating the text; since JSON has no such notion, each alias becomes an expanded copy of the original value in the resulting JSON — also warned about. An anchor that points to itself (a circular reference) is rejected: JSON has no way to represent a value that contains itself.

Multiple documents (---)

A single YAML file can contain more than one document, separated by a --- line. When converting to JSON, each document becomes an item of an array; a YAML with just one document still becomes the direct value, without wrapping it in an unnecessary array. In the other direction, a root-level JSON array can become multiple documents separated by --- (an explicit option, since the same array could also legitimately become a plain YAML sequence — the tool never decides that on its own).

Frequently asked questions

No. All conversion happens in your browser — the JSON or YAML you paste here never travels over the internet and is never logged anywhere.

Because this tool follows YAML 1.2, which fixed the "Norway problem" from version 1.1 — see the section above. Only true/false (in any case) are parsed as booleans.

They're dropped when converting to JSON — JSON has no comment syntax. The tool always warns when that happens, never silently.

They're YAML's way of reusing a value in more than one place (&name defines it, *name reuses it) without repeating the text. Since JSON has no such notion, each alias becomes an expanded copy of the original value — also warned about. An anchor that references itself is rejected, because JSON can't represent that.

Because, without quotes, a value that looks like that is parsed as a number — and numbers don't keep trailing or leading zeros. To preserve those exact characters (a version, a postal code, a code), wrap the value in quotes in the source YAML.

Yes, in both directions — each side is fully parsed, and any structural problem (duplicate key, inconsistent indentation, trailing comma, unterminated string) is reported with line and column, not just "invalid input".

It only exists in JSON → YAML and only has an effect when the input JSON is a root-level array: on, each array item becomes its own YAML document, separated by ---; off, the whole array becomes a single YAML sequence. There's no option in the YAML → JSON direction — the tool detects how many documents exist on its own.

File upload accepts up to 5 MB. Pasting directly into the text field has no technical limit, but very large inputs may slow the browser down.