Developer

Encoders, converters & dev utilities

12 tools
Developer · Data-Format Converter (JSON ↔ CSV / YAML / XML)

JSON to YAML Converter

Convert JSON into YAML — the indentation-based format used for Kubernetes manifests, CI/CD pipelines, and application config. Because YAML 1.2 is a strict superset of JSON, every JSON document maps cleanly onto YAML: objects become key-value blocks, arrays become dash-prefixed lists, and nesting is expressed with two-space indentation instead of braces. So {"db":{"host":"x"}} becomes db: on one line and host: x indented beneath it. The result is far more readable for humans and round-trips back to identical JSON. JSON is parsed per RFC 8259 and emitted with a YAML 1.2.2 writer (js-yaml core schema). Runs entirely in your browser. Free, no login.

Quick answer

YAML 1.2 is a superset of JSON: objects → key blocks, arrays → dashed lists, nesting → indentation

  • Worked example — {"db":{"host":"x"}} → db:\n host: x (two-space indent, no braces)
  • Round-trips: YAML→JSON returns the identical original JSON value
  • Default two-space indent (configurable); scalars quoted only when YAML requires it
  • JSON parsed per RFC 8259, YAML written per YAML 1.2.2 — 100% client-side, nothing uploaded
Open the full Data-Format Converter (JSON ↔ CSV / YAML / XML)

Frequently asked questions

How do I convert JSON to YAML?

Paste your JSON and it is re-emitted as YAML. Because YAML 1.2 is a superset of JSON, the mapping is direct: {"db":{"host":"x","port":5432}} becomes db: with host: x and port: 5432 indented two spaces beneath it. Objects turn into key blocks, arrays into dash-prefixed list items, and the whole structure uses indentation instead of {} and []. The conversion is byte-for-byte reversible and runs in your browser.

Is YAML really just a superset of JSON?

Yes — the YAML 1.2 specification explicitly defines YAML as a superset of JSON, meaning any valid JSON document is also valid YAML. That is why conversion is lossless in both directions: the two formats describe the same data model (maps, sequences, scalars) with different syntax. YAML simply adds human-friendly conveniences like indentation-based nesting, comments, and unquoted strings on top of JSON's structure.

How much indentation does the YAML use?

Two spaces per nesting level by default, which is the near-universal convention for Kubernetes and CI/CD YAML. YAML forbids tabs for indentation, so spaces are always used. You can change the indent width if your style guide differs, but two spaces keeps the output compatible with the widest range of YAML tools and linters.

Related Data-Format Converter (JSON ↔ CSV / YAML / XML) pages