JSON to YAML Converter
Turn JSON into clean, human-friendly YAML for Kubernetes, Docker Compose, GitHub Actions or Ansible, with full control over indentation, style and quotes.
Runs in your browserNo sign-upNothing uploaded
How to use the JSON to YAML
- Paste JSON into the left box or open a
.jsonfile. - YAML appears on the right as you type.
- Choose the indent (2 or 4 spaces) and style: block (one key per line) or flow (
{a: 1}/[x, y]) from a given nesting level. - Pick a quoting style and tick Sort keys if you want alphabetical order.
- Copy or download the YAML. Invalid JSON is reported with its line, column and likely cause.
Why convert JSON to YAML?
JSON is ideal for machines and APIs, but YAML is easier for people to read and edit: no braces, no mandatory quotes and support for comments. Most infrastructure tools, including Kubernetes, Helm, Docker Compose, GitHub Actions, GitLab CI and Ansible, are configured in YAML, while the data you start from (API output, kubectl get -o json, Terraform state) is often JSON.
Block vs. flow style
Block style puts each key and list item on its own line and is the conventional choice for config files. Flow style uses inline {} and [], like JSON, and keeps short leaf structures compact. “Flow from level 2” keeps the top two levels in block style and inlines anything deeper, which works well for long lists of small objects such as ports or env vars.
Safe quoting
Strings that a YAML parser could misread are quoted automatically: values like 'no', 'on', '1.0', 'null', strings with a leading * or &, and strings containing : . Choose Always single or Always double if your style guide requires every string to be quoted.
YAML 1.1 vs 1.2 gotchas
This converter follows YAML 1.2, the current spec. Many older tools (PyYAML, Ruby's Psych, some Kubernetes and Ansible versions) still read YAML 1.1, where the rules differ:
- The Norway problem: in YAML 1.1,
country: nomeansfalse, so Norway's country codeNOdisappears. The same goes foryes,on,off,yandn. YAML 1.2 only treatstrueandfalseas booleans. - Octal numbers:
0755is octal in 1.1 but a plain decimal in 1.2, which uses0o755. Quote file modes to be safe. - Sexagesimal numbers: in 1.1,
22:30can parse as the number 1350. Quote times and port mappings such as"8080:80".
The JSON → YAML direction quotes ambiguous strings ('no', 'on', 'y') automatically, so the YAML it produces reads the same in both versions.
Frequently asked questions
Is the conversion lossless?
Why are some strings quoted and others not?
'yes', '123' or strings with special characters. Everything else is left plain for readability.Can I add comments to the output?
# comments to the YAML after copying it.