Skip to content
PocketDesk
Your files are processed on your device, never uploaded

JSON to YAML

  • On device
Input
Ln 1, Col 11 line0 BUTF-8

Paste, drop or open a file in Input to see the result here.

Waiting for input
  • ⌘Enter Format
  • ⌘⇧C Copy result
  • ⌘F Find in result
  • Esc Exit full screen
  • Use Ctrl instead of ⌘ on Windows and Linux

How to convert JSON to YAML

  1. Paste your JSON into the Input box, or open a .json file.
  2. Choose 2 or 4 spaces of indentation.
  3. Turn on Sort keys if you want a predictable order.
  4. Select Copy, or Download to save data.yaml.

If the JSON has a syntax error, you see the line and column instead of YAML. Fix it and the output appears.

What YAML is

YAML is a human-friendly data format used for configuration. It shows structure with indentation instead of braces and quotes, so files are shorter and easier to read. You will find it in Kubernetes manifests, Docker Compose, GitHub Actions, OpenAPI specs and many static site tools.

The same data in both formats:

  • JSON: {"server": {"port": 8080, "hosts": ["a", "b"]}}
  • YAML: three short lines with a nested server: block and a dash for each host.

How the output is written

  • Objects become key: value lines, and arrays become lists with a leading dash.
  • Long text is never wrapped, so values stay on one line.
  • Strings that could be mistaken for numbers, booleans or null are quoted.
  • Text with line breaks is written in a readable block style.
  • Hindi, emoji and other Unicode text is kept as written.

Tips

  • Going back? Use YAML to JSON, which uses safe parsing.
  • Tidy the source first with the JSON formatter if it is hard to read.
  • YAML is sensitive to indentation, and tabs are not allowed. The output uses spaces only.
  • Duplicated objects are written out in full, not as anchors and aliases, so every part of the file stands on its own.

Privacy

Config files often include hostnames, tokens or internal settings. The conversion runs only on your device. Nothing is uploaded, stored or logged.

Questions

Is YAML a superset of JSON?

Nearly. Most JSON is also valid YAML, but YAML adds comments, anchors and indentation-based structure that are easier to read.

Why are some strings quoted in the output?

Text such as "true", "123" or "null" would be read as another type, so it is quoted to keep it a string.

Are comments kept?

JSON has no comments, so there are none to keep. You can add comments to the YAML afterwards.

Can I use this for Kubernetes or Docker Compose files?

Yes. Convert the JSON, then review the result. The tool does not know the schema of your file.

Is my JSON uploaded?

No. The conversion runs in your browser.

More developer tools