← All tools
// Data / Developer

JSON ↔ YAML online

Convert between JSON and YAML data formats — browser-side

JSON to YAML Converter logo
by
CHUNKY
MUNSTER

How to Use the JSON to YAML Converter

  1. Pick a direction: JSON → YAML or YAML → JSON.
  2. Paste the source document into the input box.
  3. Click Convert — the result appears in the output panel.
  4. Use Download .txt to save the converted file.

Convert between JSON and YAML in either direction. JSON → YAML emits clean 2-space block style with multi-line strings rendered as block scalars (|), suitable for Kubernetes manifests, Helm values files and Docker Compose. YAML → JSON parses indentation-based mappings, dash lists and inline scalars and returns formatted JSON.

How the JSON to YAML Converter Works

Conversion uses a hand-written serialiser rather than a heavy library, so it streams in the browser with no upload. Edge cases handled include strings that collide with YAML reserved words (true, null, on/off), strings with leading/trailing whitespace, and nested empty containers. The reverse parser is intentionally conservative — anchors, aliases, tags and merge keys are out of scope.

Frequently Asked Questions

Which YAML version does the output target?

YAML 1.2 conventions: 2-space indentation, lowercase true/false/null, and block-scalar (|) syntax for any string containing a newline. The output is compatible with kubectl, Helm, Docker Compose and PyYAML 6+.

Why are some strings quoted in the YAML output?

Strings that could be misinterpreted as YAML scalars — the words true/false/null, anything beginning with - or ?, leading or trailing whitespace, or containing : { } [ ] , # & * | < > = ! % @ — are wrapped in double quotes so the value round-trips cleanly.

Does the YAML→JSON direction support anchors and aliases?

No. The reverse parser handles flat key:value pairs, nested mappings via indentation, and dash lists, but not YAML anchors (&), aliases (*), tags (!!str) or merge keys (<<). For those cases paste the canonical JSON instead.

How are numbers and booleans converted?

On JSON→YAML, numbers and booleans are emitted unquoted (42, true). On YAML→JSON, the parser tests with isNaN: anything that parses as a Number becomes a number, the literal words true/false become booleans, null becomes null, everything else stays a string.

Explore the full suite of Data tools and 290+ other free utilities at Chunky Munster.