YAML ↔ JSON

YAML ↔ JSON converter

Convert configuration files both ways with a real YAML parser: anchors, merge keys, block scalars and multi-document files included, all in this tab.

0 characters

Direction

Parsing and serialising happen in this tab. Your configuration never leaves the device — no upload endpoint, no logging.

Short answer: pick a direction, paste the document, and the other format appears as you type. Anchors and merge keys are expanded, block scalars keep their text, and a syntax error is reported with its line instead of a generic parse failure.

Why the parser matters here

YAML's indentation rules, anchors and block scalars are not something a regular expression can handle. A converter that guesses will happily turn a nested list into a string and produce JSON that looks valid and is wrong — the most expensive kind of bug in a deployment file. This page uses the same library family that CI systems and Kubernetes tooling depend on, with the schema pinned so it cannot silently reinterpret keys.

Once the JSON is out, the JSON formatter can sort keys or minify it, and the text diff shows exactly what changed between two revisions of the same file.

What is preserved, and what is not

YAML and JSON questions

How do I convert YAML to JSON?

Paste the YAML and the JSON appears as you type. Anchors, aliases, merge keys (<<), block scalars (| and >) and multi-document files are parsed properly. If the YAML is broken, the error names the line and column instead of returning half a document.

What happens to YAML features JSON cannot hold?

Timestamps and binary tags have no JSON type. Rather than inventing one, this converter reads YAML with the JSON-compatible schema: dates stay strings, and a !!binary value is reported as an error so you can decide how to represent it. Comments are dropped, because JSON has nowhere to put them.

Are merge keys and anchors resolved?

Yes. A <<: *defaults merge is expanded into the resulting object, and aliases are expanded in place. That is what the YAML means; a converter that leaves << as a literal key produces JSON that no consumer understands.

Is this the same YAML my tools read?

It uses the JSON-compatible YAML 1.2 core schema, which is what Kubernetes, GitHub Actions, Docker Compose and most modern tools expect. One notable consequence: on, off, yes and no stay strings rather than becoming booleans — the YAML 1.1 behaviour that famously turned the country code NO into false.

Does the conversion leave my machine?

No. Parsing and serialising happen in the tab. Configuration files are exactly the kind of document that should not be uploaded, since they routinely contain hostnames, tokens and internal paths.

Related tools