How to convert JSON to YAML
- Paste your JSON into the Input box, or open a
.jsonfile. - Choose 2 or 4 spaces of indentation.
- Turn on Sort keys if you want a predictable order.
- 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: valuelines, 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.