Tools / YAML ↔ JSON Converter

YAML ↔ JSON Converter

Paste YAML or JSON into either pane — the other updates live, with line-numbered parse errors. Runs entirely in your browser; nothing you paste is sent anywhere.

Edit either pane — the other converts automatically. Last edit wins.

YAML
JSON

About

This converter reads whichever pane you last touched and rewrites the other, on every keystroke, entirely in your browser using the js-yaml library. Nothing is uploaded — there is no server involved in the conversion at all.

The two formats aren't perfectly equivalent, so converting between them is honestly lossy in both directions. YAML comments (anything after #) have no equivalent in JSON and are dropped when you convert to JSON — there's nowhere to put them. YAML anchors and aliases (&name / *name, used to avoid repeating a block) get resolved to their full, repeated values in the JSON output, since JSON has no concept of a reference. Multi-line strings, flow vs. block style, and key ordering hints are all flattened into JSON's plainer shape. Going the other way, JSON's strict quoting is relaxed into YAML's more permissive block style, and long values are kept on one line rather than force-wrapped, so copy-paste round-trips stay intact.

One quiet but useful behavior: YAML dates (like 2024-03-18) parse into real timestamps and come out as ISO-8601 strings in the JSON pane, which is usually what you want when piping YAML config into JSON-consuming tools.

If your YAML has a syntax problem — a stray tab used for indentation, an unterminated flow collection — the error shows up in that pane's footer with the exact line and column, and the other pane keeps whatever it last converted successfully. Multi-document YAML streams (separated by ---) convert only the first document; a note tells you how many were found.

FAQ

Why did my comments disappear?
JSON has no comment syntax at all, so there's nowhere for a YAML # comment to go when converting to JSON. This is lossy by definition, not a bug in the tool — if you need to preserve comments, keep your source YAML file as the record and treat the JSON output as a derived artifact.
Does `no` turn into `false`? (the YAML “Norway problem”)
Not in this tool. Older YAML 1.1 parsers treat bare no, yes, on, and off as booleans — famously turning the country code “NO” (Norway) into false. This converter uses js-yaml's default parsing schema, which follows YAML 1.2-style core-schema rules: only bare true and false resolve to booleans. no, yes, on, and off all come through as plain strings. If you're relying on the old 1.1 behavior from another tool, you'll see a difference here — quote your intended strings if you want to be unambiguous either way.
Is my data uploaded anywhere?
No. Parsing and conversion both happen in your browser via the js-yaml library — nothing you paste is sent to a server, logged, or stored. Close the tab and it’s gone.

Related