JSON to YAML Converter is a free tool that turns JSON into clean, readable YAML, the format used by Kubernetes, Docker Compose, GitHub Actions and many other configuration systems. Key order is preserved and strings that need quotes get them. The conversion runs in your browser.
How to convert JSON to YAML
- Paste your JSON into the left box, or open a
.jsonfile. - The YAML appears on the right. Choose 2 or 4 spaces of indentation.
- Copy it, or download it as a
.yamlfile.
Example
{"service":"web","ports":["80:80"],"environment":{"TZ":"UTC"},"replicas":2}becomes:
service: web
ports:
- "80:80"
environment:
TZ: UTC
replicas: 2Notice that "80:80" keeps its quotes: without them, some YAML readers would treat it as a number in base 60.
Why use YAML?
YAML describes the same data as JSON, but without brackets, braces and most quotes, and it allows comments. That makes long configuration files much easier for people to read and edit. JSON remains better for data exchanged between programs.
Good to know
- If your JSON has an error, it is shown with its line and column. The JSON Validator lists every problem at once.
- Very large numbers (beyond about 9 quadrillion) lose precision, as in any JavaScript program.
- Comments can’t be created from JSON, since JSON has none; add them to the YAML afterwards.
Frequently asked questions
Is YAML the same data as JSON?
Yes. YAML is a superset of JSON, so any JSON can be written as YAML with the same meaning. YAML just uses indentation instead of brackets and quotes.
Is key order preserved?
Yes, keys appear in the same order as in your JSON.
Why are some values quoted in the YAML?
Strings that YAML would otherwise read as something else, such as "80:80", "yes" or "1.0", are quoted so they stay text.
Last updated