JSON to YAML
Convert JSON to YAML online for free. Paste JSON and get readable YAML instantly, in your browser.
Suggested tools
About JSON to YAML
JSON to YAML converts JSON into clean, readable YAML for Docker Compose, Kubernetes, GitHub Actions, Ansible and other configuration files. Objects, arrays, numbers, booleans and null values carry over exactly.
The YAML uses two-space indentation and never wraps long lines, and strings that could be misread (such as "yes" or "0123") are quoted automatically. It runs entirely in your browser, so nothing you paste is uploaded.
How to use JSON to YAML
- Paste JSON, upload a .json file or click Sample.
- Press Convert.
- Copy or download the YAML.
Key features
- Exact data types preserved
- Two-space indentation, no line wrapping
- Ambiguous strings quoted automatically
- Validates the JSON first with clear errors
Example
A small Docker-style service definition converted to YAML.
{"service":"web","image":"nginx:1.27","ports":["80:80"],"restart":true}service: web image: nginx:1.27 ports: - '80:80' restart: true
When to use JSON to YAML
- Turning JSON examples from documentation into YAML for Kubernetes or Docker Compose.
- Making a large JSON config easier to read and comment.
- Converting API specifications to YAML.
Tips and common problems
- After converting, add # comments — YAML supports them, JSON does not.
- Strings that YAML could misread (yes, 0123) are quoted automatically; keep those quotes.
- Indent with spaces only if you edit the YAML by hand.
Frequently asked questions
It is easier to read and edit than JSON, supports comments and needs fewer brackets and quotes.
Yes, YAML supports # comments — add them in your editor after converting.
Yes, with YAML to JSON.
Guides
- JSON vs XML vs YAML — JSON vs XML vs YAML compared: strengths, weaknesses and best uses, to help you choose the right data format for APIs, config files and documents.