{ } JSON Workbench0 network requests. Check DevTools

"JSON to YAML":{ }

Paste JSON and get clean, 2-space-indented YAML ready for Kubernetes, Docker Compose, or CI configs. Strings that look like numbers, booleans, or contain special chars are auto-quoted; multiline strings become block scalars. Repair-aware, powered by js-yaml, 100% in-browser.

What is JSON to YAML conversion?

JSON is compact and API-native; YAML is human-authored config. Converting turns machine output (API responses, generated manifests) into the readable, comment-friendly format that DevOps tooling expects. The tricky part is knowing which strings to quote so they don't get coerced (the “Norway Problem” in reverse), and that's handled automatically.

Edge cases & gotchas

  • Auto-quoting triggers: boolean-like strings (yes/no/on/off), numeric-looking strings ("1.10", IDs), leading/trailing whitespace, and special chars (#, &, *, @, :).
  • Norway Problem in reverse: a string "NO" must stay quoted or it reads back as false.
  • Multiline: literal | preserves newlines vs folded > collapses them.
  • Null: emitted as null (or ~).
  • Indentation: 2-space, no tabs. YAML forbids tabs.
  • Key order: preserved from JSON insertion order.

When strings get quoted

TriggerExampleWhy
Boolean-likeno, onavoid coercion to bool
Numeric-like1.10, 01234keep as string
Special charkey: value #1: / # ambiguous
Leading/trailing space" x "preserved literally

How to use

  1. Paste JSON into the Input pane, upload, or load text.
  2. The repair-aware parser tolerates trailing commas and minor errors on input.
  3. Pick indentation (2-space is the Kubernetes convention).
  4. Convert: js-yaml emits YAML, auto-quoting ambiguous strings.
  5. Copy the result or download it as .yaml.

Examples

Object → key-value YAML

Input
{ "name": "api", "port": 8080, "ssl": true }
Output
name: api
port: 8080
ssl: true

Multiline string → block scalar

Input
{ "description": "Line 1\nLine 2\nLine 3" }
Output
description: |-
  Line 1
  Line 2
  Line 3

Coercion-safe quoting

Input
{ "version": "1.10", "enabled": "no", "note": "key: value #1" }
Output
version: "1.10"
enabled: "no"
note: 'key: value #1'

FAQ

Why convert JSON to YAML?

YAML is more readable for config and is the native format for Kubernetes, Helm, Ansible, and CI pipelines.

Is JSON valid YAML?

Yes: YAML is a superset of JSON, but converting produces the readable, indented style people expect.

How are multiline strings handled?

Strings with \n become literal block scalars (|), preserving line breaks.

Why did my string get quoted?

To prevent coercion. Values that look like numbers or booleans, or contain :, #, &, *, or leading zeros, are quoted.

How do I convert JSON to YAML in CLI or Python?

yq -P (CLI) or yaml.safe_dump(json.load(...)) (Python).

Is my data uploaded?

No. js-yaml runs in your browser; verify zero requests in DevTools. Need the reverse trip? Use YAML to JSON.

Related tools