RunTheTests
/

YAML Validator & Converter

Convert YAML to JSON and back, with ambiguous strings quoted.

What you paste

Parsed in your browser — never uploaded

How this reads your output

The direction is detected from what you paste, so JSON becomes YAML and YAML becomes JSON without choosing a mode. The interesting work happens on the way to YAML: any string that could be mistaken for another type gets quoted. That includes yes, no, on, off, anything resembling a number, and version strings, all of which YAML would otherwise convert to something else entirely.

What the results mean

Ambiguous strings quoted
Values that would be read as booleans or numbers if left bare. The count is worth glancing at, since each one would have been a silent type change.
Nesting depth
How deep the structure goes. YAML indentation errors get harder to spot with depth, which is why deeply nested configuration is worth restructuring.
Keys
Total keys across the whole structure, which is a rough measure of how much configuration you are dealing with.

Common problems and fixes

A value like "no" or "off" became false
This is the Norway problem, named after country lists that lose Norway because its code NO is read as the boolean false. Quote the value, which this converter does automatically in that direction. YAML 1.2 narrowed the rule to just true and false, but many parsers still implement the older behaviour.
A version number lost its trailing zero
It was read as a number, so 1.10 became 1.1. Version strings, postcodes with leading zeros and telephone numbers all need quoting for the same reason. Anything that looks numeric but is really an identifier should be a quoted string.

Frequently asked questions

Is JSON valid YAML?

Yes, since YAML 1.2 is formally a superset of JSON, so any valid JSON document is also valid YAML. The reverse is not true, because YAML has comments, anchors, multiple documents and several scalar styles that JSON has no way to express.

What happens to comments?

They are lost going to JSON, because JSON has nowhere to put them. That is worth remembering before round-tripping a configuration file through JSON and back, since the comments explaining why a value was chosen do not survive the trip.

Should I use tabs for indentation?

Never. YAML forbids tabs for indentation outright, and a parser will reject the file rather than interpret it. Configure your editor to insert spaces in YAML files, since this is one of the most common causes of a config that will not load.

Put this on your own site

Free to embed, no attribution required beyond the source link the frame carries itself. It runs entirely in your visitor's browser, sets no cookies and loads no third-party script.

Embed code
<iframe src="https://runthetests.com/embed/yaml-json-converter/" width="100%" height="720" style="border:1px solid #e5e5e5;border-radius:8px" title="YAML Validator & Converter" loading="lazy"></iframe>

Preview it at https://runthetests.com/embed/yaml-json-converter/. Embedded pages are marked noindex, so yours stays the canonical copy — not this one.

More in DevTools