JSON to YAML converter

Paste JSON to get equivalent YAML. Strings that YAML would misread (like yes, 1.0 or values containing : ) are quoted automatically.

How the YAML is written

Objects become indented key: value mappings (2 spaces per level), arrays become - item lists, and lists of objects place the first key on the dash line, the style used in Kubernetes manifests. Empty objects and arrays are written as {} and [].

Strings that get quoted

JSON stringYAML outputWhy
"yes""yes"YAML 1.1 parsers read yes as true
"1.0""1.0"Would become a number
"a: b""a: b"Colon-space starts a mapping
"#tag""#tag"# starts a comment
""""Empty value would be null

Supported YAML subset

The YAML reader handles what most config files use: nested mappings by indentation, block lists (- item), lists of mappings, plain, single- and double-quoted scalars, numbers, true/false, null/~, comments, | and > block scalars, and JSON-style flow collections such as [1, 2].

Not supported: anchors and aliases (&, *), tags (!!str), multiple documents in one stream, complex keys and YAML 1.1 booleans like yes/on (they stay strings, as in YAML 1.2). For those files use a full YAML library.

Frequently asked questions

Is YAML a superset of JSON?
YAML 1.2 is designed so that almost any JSON document is also valid YAML, which is why flow syntax like [1,2] works in YAML files.
Why 2-space indentation?
It is the convention for Kubernetes, Compose and most CI files. YAML forbids tabs for indentation.