YAML to JSON Converter (and JSON to YAML)

Turn a config file into JSON, or JSON into clean, readable YAML. Nothing is uploaded.

Examples:


How it works

Paste YAML or open a .yaml or .yml file. The parser follows YAML 1.2 with the core schema, the version most modern tools use: nested mappings and lists by indentation, flow style such as [a, b] and {k: v}, comments, single and double quotes with escapes, and block text written with | (keeps line breaks) or > (joins lines with spaces), including the - and + markers that control the final line break. Anchors (&name), aliases (*name) and merge keys (<<: *defaults) are expanded, which is how many Rails, CI and Docker files share settings.

A file with several documents separated by ---, such as a Kubernetes manifest, becomes a JSON array, or you can keep just the first document. If something is wrong you get the line number and a few lines of context, with plain-words messages like Tabs can't be used for indentation instead of a bare parser code.

YAML has famous traps, and the tool points them out instead of hiding them. Older YAML 1.1 tools read no, yes, on and off as true and false (country code NO for Norway turning into false is the classic example), treat 0755 as an octal number and 22:22 as a base-60 number. This converter uses the safer 1.2 rules and warns you, and YAML 1.1 rules switches to the old behaviour so you can see what an older tool will do. Integers too large for JavaScript are kept as text rather than silently rounded.

Going from JSON to YAML, strings are only quoted when they must be: anything that would otherwise read as a number, a date, true/false/null or one of the 1.1 words, or that starts with a YAML symbol. Multi-line text is written as a readable | block. Because aliases can make a tiny file expand enormously (the billion laughs trick), conversion stops at a million values rather than freezing your browser.

Questions

Is my file uploaded?

No. YAML is parsed and converted in JavaScript on your device. Nothing is sent to the server, so it is safe for configs that contain internal hostnames or keys.

Why did no turn into false in another tool?

That tool follows YAML 1.1, where yes/no/on/off are booleans. YAML 1.2 keeps them as text. Quote the value ("no") and every tool will agree.

Does it support every YAML feature?

It covers what real config files use. Complex keys written with ? and custom tags that have no JSON equivalent are reported rather than guessed. Comments are dropped, because JSON has no comments.

Can I use it to check that my YAML is valid?

Yes. If it converts, the structure parsed cleanly; if not, the error names the line. It does not check a schema, such as whether a Kubernetes field name is spelled correctly.

Related tools

Guides