JSON to YAML

Runs in browser JSON & Data

Transform JSON into YAML with correct quoting of ambiguous scalars, multi-line strings and nested collections — handy for Kubernetes manifests, CI pipelines and OpenAPI files.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

How to use JSON to YAML

  1. Paste the JSON document.
  2. Choose indentation, block or flow style and whether to quote all strings.
  3. Copy the YAML into your manifest, pipeline or OpenAPI file.

JSON to YAML features

  • Converts any JSON value to YAML 1.2
  • Quotes ambiguous scalars (true, 0123, null, dates) so types survive
  • Block or flow collection style, 2 or 4 space indentation
  • Multi-line strings emitted as literal block scalars
  • Optional quoting of every string
  • Live conversion with copy and download

JSON to YAML example

JSON to a Kubernetes-style manifest

Input:

{"apiVersion":"v1","kind":"ConfigMap","data":{"LOG_LEVEL":"info","DEBUG":"true"}}

Output:

apiVersion: v1
kind: ConfigMap
data:
  LOG_LEVEL: info
  DEBUG: "true"

Frequently asked questions about JSON to YAML

Will strings like "true" or "0123" stay strings?

Yes. Values that YAML would otherwise interpret as booleans, numbers, nulls or dates are quoted automatically so their type survives a round trip.

What is the difference between block and flow style?

Block style puts each list item and key on its own line (the usual Kubernetes/CI look). Flow style writes short collections inline, like [a, b] and {x: 1}.

Are multi-line strings supported?

Strings containing newlines are emitted as literal block scalars (|), which keeps them readable and exact.

Is the YAML output valid YAML 1.2?

Yes. The converter uses the core YAML 1.2 schema, which is what Kubernetes, GitHub Actions, Docker Compose and OpenAPI tooling expect.

Technical notes

Serialisation uses the yaml package (2.x) with the YAML 1.2 core schema and lineWidth 0, so long strings are never folded across lines. Scalars are double-quoted only where 1.2 would misread them — "true", "null", "0123", "1e3", empty strings, values starting with an indicator such as #, &, *, ! or [ or containing ": ". Because 1.2 reads yes, no, on, off and ISO dates as plain strings, they stay unquoted; YAML 1.1 consumers such as PyYAML interpret them differently.

Strings containing newlines become literal block scalars (| or |- depending on the trailing newline), block sequences are indented under their parent key, and anchors or aliases are never emitted. 'Flow style' applies to every collection including the root, so the whole document collapses to one { … } line. 'Quote all strings' touches values only — keys stay plain unless they need quoting — and because the input passes through JSON.parse first, integers above 2^53 − 1 are already rounded.