All tools run in your browser — your files never leave your device.
All tools154

Utilities & Converters

YAML to JSON Converter

YAML to JSON and back, with the gotchas flagged.

What it does. YAML is a superset of JSON, so every JSON document is already valid YAML. Converting the other way is where problems appear, because YAML infers types from unquoted text — and some of those inferences are surprising enough to have their own names.
Runs in your browserNothing uploadsNo signupWorks offline

How to use YAML to JSON Converter

  1. Paste YAML or JSON.
  2. Read any type warnings before trusting the output.
  3. Copy the result.

The Norway problem

In YAML 1.1, the unquoted values no, yes, on, off, true and false are all booleans.

The country code for Norway is NO. A list of country codes written unquoted turns Norway into the boolean false — a real, repeatedly-reported bug with a real name.

YAML 1.2 narrowed this to true and false only, but a great deal of tooling still implements 1.1 semantics. The safe habit is to quote any string that could be read as something else, always.

Other coercions worth knowing

  • Leading zeros — version: 010 can parse as octal 8.
  • Sexagesimal — 12:30 can become 750 in YAML 1.1.
  • Empty value — a key with nothing after the colon is null, not an empty string.
  • Tabs are illegal for indentation. Spaces only, and the error message is often unhelpful.
  • Duplicate keys are invalid but many parsers silently take the last.

Quoting removes almost all of these. If a value is meant to be a string, quote it — the cost is two characters and the alternative is a class of bug that only appears with particular data.

What JSON cannot round-trip

YAML has anchors and aliases for reuse, multi-document files separated by ---, comments, and several block styles for multi-line strings.

None of those survive a trip through JSON. Anchors are expanded, comments vanish, and only the first document of a multi-document file converts.

That matters most for configuration files, where comments are frequently the only documentation. Converting a commented YAML config to JSON and back silently deletes the explanations.

Frequently asked questions

What is the Norway problem?

In YAML 1.1, unquoted no and yes are booleans — so the country code NO becomes false. It is a real and repeatedly-reported bug. Quote any string that could be read as something else.

Is JSON valid YAML?

Yes. YAML is a superset of JSON, so every JSON document parses as YAML. The reverse is not true, which is where the conversion problems live.

Why did my version number change?

A leading zero can be read as octal in YAML 1.1, so 010 becomes 8. Quote version numbers and anything else where the literal text matters.

Do comments survive conversion to JSON?

No. JSON has no comment syntax, so they are deleted. That matters most in configuration files where comments are often the only documentation.

Can I use tabs to indent YAML?

No. Tabs are illegal for indentation in YAML and the resulting parse error is often unhelpful about why. Use spaces.