Direction
Switch between JSON to YAML and YAML to JSON. When you switch, the current result moves into the input box, so you can convert straight back the other way.
JSON to YAMLAfterYAML to JSONPaste JSON to turn it into clean, readable YAML, or switch the direction to turn YAML back into JSON. The tool checks your input as you type and points at the exact line and column when something is wrong. Everything runs in your browser, so your data stays on your device.
JSON and YAML are two ways to write the same data. JSON uses braces and brackets and is what most APIs and programs read. YAML uses indentation instead of braces, which makes it easier for people to read and is why it is used for config files in Docker, Kubernetes, and GitHub Actions. This converter reads one format and writes the other with the same keys, values, and nesting, so you can move between a machine friendly JSON payload and a human friendly YAML config in seconds.
Switch between JSON to YAML and YAML to JSON. When you switch, the current result moves into the input box, so you can convert straight back the other way.
JSON to YAMLAfterYAML to JSONChoose 2 or 4 spaces for each level of nesting. Both JSON and YAML use spaces, so the result stays valid either way and matches your project's style.
a:
- 1
- 2Aftera:
- 1
- 2Puts the keys of every object or mapping in alphabetical order, all the way down. List order is left alone, since the position of items in a list has meaning.
name: pear
age: 2Afterage: 2
name: pearThe status bar checks your input as you type and points at the exact line and column of any error, so you fix the source before converting.
key: [unclosedAfterError on line 1The data stays the same, but a few things do not survive the trip. Each of these was checked with this converter:
| Going | What happens |
|---|---|
| JSON to YAML | Text that looks like a number keeps its quotes, so "1.10" and "01234" stay text. Values with a colon, like "a: b", are quoted too. |
| JSON to YAML | The text "yes" is written as answer: yes without quotes. That is correct YAML 1.2, but an older YAML 1.1 tool would read it as true. Quote it by hand if your tool is old. |
| YAML to JSON | Comments are dropped, since JSON has no comments. |
| YAML to JSON | Anchors and aliases (&base and *base) are expanded, so the shared block is copied into every place that used it. |
| YAML to JSON | Merge keys like <<: *defaults, common in Docker Compose and GitLab CI files, are not merged. They come out as a key literally named "<<", so check those files by hand. |
Key order is kept in both directions unless you turn on Sort keys, so a converted file lines up with the original when you compare them.
JSON and YAML each have their place, and moving between them comes up often. Here are the most common reasons: