How to use the JSON to YAML Converter
- Paste your JSON into the left box, or open a file.
- Adjust the options if you need to.
- Copy the YAML or download it as a file.
What does this tool do?
YAML is the configuration format behind Kubernetes, Docker Compose, GitHub Actions and many CI tools, but API docs and examples are usually written in JSON. This converter turns JSON into equivalent YAML with two-space indentation.
Strings are only quoted when needed, so the YAML stays readable, and long lines aren't wrapped, which keeps values intact. Check the result with the YAML to JSON converter to confirm it round-trips.
When strings get quoted, and one trap
A string is quoted when plain YAML would read it as something else. "true", "123", "1.10" and "a: b" all come out in quotes, so a version number such as 1.10 does not silently become the number 1.1. Strings that are safe, such as localhost, are left plain. Multi-line strings are written as a literal block (the |- form).
The trap is the word no. It is written without quotes, because the YAML 1.2 standard treats it as ordinary text. Some older parsers follow YAML 1.1, where no, yes, on and off mean booleans. If your file will be read by a Python or Ruby tool of that age, quote those values by hand.
Related: YAML to JSON converter · JSON validator · JSON formatter
What the converter will and will not accept
The input must be strict JSON. Comments, trailing commas and single-quoted strings are rejected with an error that shows the line and column. Fix those first with the JSON validator.
Numbers are read as ordinary JavaScript numbers, so an integer longer than about 15 digits loses precision before it ever reaches YAML: 12345678901234567890 comes out as 12345678901234567000. Keep such IDs as strings in the JSON. Key order is preserved, and long lines are never folded.
Why use it?
- Write configuration files faster.
- Convert API examples into YAML configs.
- Readable output with sensible quoting.
Worked example: how different JSON values are written
Input: {"server":{"port":8080,"host":"localhost"},"tags":["a","b"],"empty":[],"none":null,"flag":"true","multi":"line1
line2"}. Notice that the string "true" keeps its quotes, so it is not read back as a boolean, and the two-line string becomes a block.| JSON | YAML output |
|---|---|
| "port": 8080 | port: 8080 |
| "tags": ["a", "b"] | tags: then - a and - b on separate lines |
| "empty": [] | empty: [] |
| "none": null | none: null |
| "flag": "true" | flag: "true" |
| "multi": "line1 line2" | multi: |- followed by the two lines indented |
Privacy
Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.
Frequently asked questions
Is valid JSON also valid YAML?
Almost always. YAML 1.2 was designed as a superset of JSON, so most YAML parsers can read JSON directly. Converting just makes it easier for people to read and edit.
Why are some values in quotes?
Strings that would otherwise be read as something else — like “true”, “123” or “null” — are quoted so they stay strings. Everything else is left unquoted for readability.
Content last updated . See how M2Toolkit works.