YAML to JSON Converter

Convert YAML to JSON or JSON to YAML, live as you type. Runs entirely in your browser, nothing you paste is uploaded.

Config files, made portable

YAML is common in Docker Compose, Kubernetes, and CI configs.

YAML is easier for humans to read and edit, but JSON is what most APIs and programming languages expect. This tool converts between the two entirely in your browser, both directions.

What's supported

Block and flow mappings and sequences, quoted and plain scalars, numbers, booleans, null, and comments. Anchors/aliases, multi-document files, and multiline block scalars (| / >) aren't supported.

How it works

YAML to JSON runs a small recursive-descent parser written for this page. It first strips comments (carefully, so a # inside a quoted string survives), records each line's indentation, then builds the structure the way YAML defines it: indentation opens nested maps, lines starting with - build sequences, and everything else is a scalar. Scalars are typed by the same rules real YAML parsers use: true/false become booleans, ~ and null become null, bare numbers become numbers, quoted strings stay strings, and inline [a, b] or {k: v} flow syntax is handled too. The result is serialized with JSON.stringify at your chosen indent. JSON to YAML is the reverse: JSON.parse validates the input, then an emitter walks the value and writes indented YAML, quoting any string that would otherwise be misread as a number, boolean, or null.

One deliberate choice worth knowing about: this parser only treats literal true and false as booleans. Older YAML 1.1 parsers also convert yes, no, on, and off, which is how Norway's country code NO famously becomes false in config files (the "Norway problem"). Here it stays the string it looks like.

It is a subset parser, kept small on purpose: anchors and aliases (&/*), multi-document files, and block scalars (| and >) aren't supported, so a complex Kubernetes manifest using those features won't round-trip. For everyday config conversion it covers what you actually paste.

Conversion happens entirely in your tab on every keystroke. No parser service is called: DevTools' Network panel stays silent while you type, so config files full of hostnames and secrets never leave your machine.

Common questions

Does this handle every YAML feature?

It covers the common subset used in most config files: mappings, sequences, scalars, quoted strings, flow syntax like [1, 2, 3], and comments. Advanced features like anchors/aliases, multi-document files, and multiline block scalars aren't supported.

Is my data uploaded anywhere?

No. Parsing and conversion happen entirely in your browser with JavaScript. Nothing you paste is sent to a server.

Can I convert JSON back to YAML?

Yes, use the JSON → YAML tab, or hit Swap after converting to flip direction with your current output as the new input.