Skip to content
Developer

YAML ↔ JSON Converter

Paste YAML to get JSON, or JSON to get YAML. Parse errors report the line and column. If your YAML has comments, the tool tells you before they disappear.

Press Esc to clear

JSON

About the YAML ↔ JSON Converter

YAML and JSON describe the same data model, so converting between them is mechanical. There is one thing that does not survive the trip, and it is the thing people most often care about: comments. JSON has no syntax for them, so a parser reads a commented YAML file and discards every comment on the way in. Convert back and you get a structurally identical document with all the explanation stripped out — which is a disaster if you were converting a config file you intended to keep using.

This tool checks for comments before converting and says so plainly, rather than letting you discover it after pasting the result over your original. That is the single most useful thing a YAML converter can do.

YAML's other trap is its type inference. The unquoted value no is a boolean in YAML 1.1, which is why country codes and answers to yes/no questions have a habit of turning into false; versions like 1.10 parse as numbers and lose their trailing zero; and a bare colon inside an unquoted string ends the value early. Parse errors here report the line and column the parser objected to, which is usually within a line or two of the real mistake.

Long strings are emitted without line wrapping. A wrapped output looks tidier and makes the diff between two versions of a config file unreadable, which is the wrong trade for a file that lives in version control.

The YAML parser is loaded only when you open this tool, and everything runs in your browser.

Frequently asked questions

Will my comments survive the conversion?

No, and that is not fixable. JSON has no comment syntax, so the parser discards them. The tool warns you when your input contains comments so you find out before replacing your original file rather than after.

Why did my value "no" become false?

YAML 1.1 treats no, yes, on and off as booleans. Quote the value to keep it as text. This catches out country codes and two-letter language codes constantly.

Is the YAML library downloaded on every page?

No. It loads only when you open this tool, so nobody who never converts YAML pays for it.