YAML to JSON

Convert YAML configs to JSON โ€” docker-compose, CI files, manifests.

About this converter

A from-scratch parser for the YAML that config files are made of: nested maps and lists, quoted and typed scalars, comments, flow-style [a, b] collections, | block text. Errors name the line where parsing stopped; tabs are silently converted to spaces before they can hurt you.

The subset promise, kept honestly

YAML's full specification is notoriously vast โ€” anchors, aliases, multi-document streams, custom tags, sexagesimal integers โ€” and no lightweight converter implements it all; the dishonest ones just don't mention it. This page's contract: the ninety-percent subset that docker-compose files, CI pipelines, Kubernetes manifests and front-matter actually use parses correctly, and input beyond the subset produces a located error ("couldn't parse line 14") rather than silently wrong output. Type coercion follows the modern sane rules โ€” 42 numbers, true booleans, quoted things stay strings โ€” which also defuses YAML's famous traps: the classic "no" that YAML 1.1 parsers read as false is preserved faithfully if quoted, and the error-or-honesty policy means you'll never discover a misparse in production. Indentation is YAML's entire grammar, so most real-world failures are a stray tab (auto-fixed here) or misaligned nesting โ€” the located error points at exactly where. The reverse trip is JSON to YAML, and the pair round-trips; the JSON formatter takes the output onward.

Frequently asked questions

Which YAML features are supported?

The config-file subset: nested maps, lists, typed scalars, quotes, comments, flow collections, | block text. Anchors, multi-doc streams and custom tags aren't โ€” and produce a clear located error, never silent misparses.

Why did parsing stop at a specific line?

The error names the first line the parser couldn't understand โ€” usually misaligned indentation or an exotic feature. Fix or simplify that line and re-run; located errors beat guessing.

How are types decided?

Unquoted 42 โ†’ number, true/false โ†’ boolean, ~ โ†’ null; anything quoted stays a string. That's modern YAML behaviour and protects the famous 'no' โ†’ false trap.

Are tabs really auto-converted?

Yes โ€” YAML forbids tabs for indentation, and a stray tab is the #1 config-file error. Converting them to spaces before parsing fixes the common case invisibly.