📝 JSON ↔ YAML

Round-trip JSON and YAML with sensible defaults — YAML 1.2, anchor and alias resolution, multi-document support.

About JSON ↔ YAML

Convert between JSON and YAML without leaving the browser. The converter is YAML 1.2-compatible — anchors and aliases are resolved into duplicated values when going to JSON, multi-document YAML (---) can be flattened or kept as an array, and special scalars (~, ISO timestamps, hex numbers) survive the round-trip when they should.

How to use

  1. Pick a direction: JSON → YAML or YAML → JSON. Switching clears both panels so the next input starts fresh in the right format.
  2. Paste your data into the left panel; the converted result appears live on the right.
  3. For YAML → JSON output, switch between Tree and Raw to either explore the structure interactively or copy the plain JSON text.
  4. Tweak the options bar — indent, block vs flow style, line width, sort keys, multi-document handling — until the output looks right.

Common use cases

  • Reading a Kubernetes / Docker Compose / OpenAPI spec without YAML eye-strain.
  • Writing a config in JSON's predictable shape, then exporting to YAML for a tool that needs it.
  • Diffing two YAML files by normalizing both to JSON first.
  • Quickly checking what a YAML anchor / alias actually resolves to.

Tips

  • Block style is the typical "outline" YAML look; flow style is closer to JSON ({a: 1, b: [x, y]}). Auto picks block for larger structures and flow for small inline ones.
  • Comments are dropped when converting YAML → JSON — JSON has no comment syntax. The status bar tells you how many were stripped.
  • Following YAML 1.2 by default, only true/false are booleans. yes/no stay as strings (a YAML 1.1 quirk we don't reintroduce).

FAQ

Are comments preserved when converting YAML to JSON?
No. JSON has no comment syntax, so they're dropped. The status bar shows a count of how many were stripped so you don't lose them silently.
How are anchors and aliases handled?
Resolved into duplicated values when going to JSON. Going JSON → YAML doesn't reintroduce anchors automatically; if you need DRY YAML, edit by hand after.
Does it support multi-document YAML (`---`)?
Yes. Choose between first doc only (default) and array of docs (each doc becomes one element of a top-level JSON array).
Why is `yes` not converting to `true`?
That's a YAML 1.1 quirk. We follow YAML 1.2 by default, where only `true`/`false` (and a few variants) are booleans. `yes`/`no` stay as strings.
What's the difference between block and flow style?
Block uses indentation and dashes — the typical outline-style YAML look. Flow looks more like JSON: `{key: value, list: [a, b]}`. Auto picks block for larger structures and flow for short inline ones.

More tools

JSON

Code

Ornaments

Image

Web / SEO

Generators

PDF