JSON to YAML converter
Convert JSON to YAML in your browser: nothing is uploaded, there is no limit on the size, and you choose the indent and whether keys are sorted. Invalid JSON shows the line and character of the error.
How it works
-
Paste your code
Paste the code in the left box or open a file. No code to hand? Click Example.
-
Instant result
The result appears as you type. If there is an error, you see the line and character.
-
Copy or download
Copy the result with one click or save it as a file for your editor or project.
Why YAML?
YAML holds the same data as JSON, but without braces and most quotes, and with indentation instead of brackets. That makes it nicer to read and edit by hand. Configuration files for Docker Compose, Kubernetes, GitHub Actions, Home Assistant and Ansible are written in YAML.
When are there quotes?
Only where they are needed. Text such as true, 123 or yes: no would mean something else in YAML than in your JSON, so it is quoted. That way the result is exactly the same when you convert it back with YAML to JSON.
A quick way to start a config file
Many tools can export or print their configuration as JSON, such as kubectl get -o json, cloud templates or an API schema. Convert it to YAML to edit it by hand, or to keep it in a repository in the format the tool expects. The structure stays exactly the same, so the YAML can be applied as it is.
What changes, and what does not
- Comments do not exist in JSON, so you start without any. Add them in YAML afterwards.
- Key order is kept unless you choose to sort the keys, which is handy for comparing two files.
Indentation matters
YAML uses spaces for structure, never tabs. Two spaces is the common choice for Docker Compose, Kubernetes and GitHub Actions; some tools prefer four. Keep it consistent across a project.
If you want to check the result, convert it back with YAML to JSON and compare, or format the JSON first with the JSON formatter.
Frequently asked questions
Why are some values in quotes in the YAML?
Text that YAML would otherwise read as a boolean, number or null is quoted, so the meaning stays the same.
Are comments kept?
JSON has no comments, so there are none to keep. You can add them to the YAML afterwards.
Can I use the YAML in Kubernetes or Docker Compose?
Yes. The result is standard YAML with the same structure as your JSON.
Is my JSON uploaded?
No. The conversion happens in your browser and nothing is sent.