Convert JSON to YAML
Convert JSON to YAML that is easy to read and edit, ready for Docker Compose, Kubernetes and CI config. Runs in your browser and nothing is uploaded.
Why convert JSON to YAML?
Docker Compose, Kubernetes, GitHub Actions, Ansible and many other tools use YAML for config. It is much easier to read and edit by hand than JSON, and it allows comments. Converting a JSON example from documentation or an API is a quick way to start a new config file.
How to convert JSON to YAML
Drop a .json file above and press Convert. The JSON is parsed, then js-yaml writes it as block-style YAML with two-space indents. Nesting, arrays and data types stay the same. Strings that YAML could misread, such as yes, no or 1.0, are quoted so they stay strings. Download the .yaml file and check it before you use it.
Compatibility
The output is standard YAML that any YAML 1.1 or 1.2 parser can read. If the JSON contains the same object twice, it is written out in full both times rather than with YAML anchors, so the result is easy to read and edit.
A quick example
The JSON {"service": {"image": "nginx", "ports": ["80:80"]}} becomes a YAML block with service on the first line, image: nginx indented under it, and ports as a list with one dash entry. That is the shape Docker Compose and Kubernetes expect, so you can paste it into a compose file and add the rest by hand.
Before you start
Input: JSON. Output: YAML. The settings appear before anything runs, so you can check them first. Your original file is never changed.
A valid file can still hold the wrong data. Before you import the result, check the row count, field names, text encoding, dates, IDs and a few unusual rows.
Keep the original until you have opened and checked the result. The work happens in this browser tab, so the size you can handle depends on your device's memory, your browser and the file itself.
Steps to convert JSON to YAML
- Drop a .json file into the box above.
- Press Convert to turn it into YAML in your browser.
- Download the YAML.
Last updated · How we build and check tools · Report an error