Home › File & PDF Tools › JSON to YAML Converter
JSON to YAML Converter
Our free JSON to YAML converter turns JSON data into clean, readable YAML right in your browser. Paste your JSON, pick the indentation, quoting style, and key order, and copy the YAML or download it as a real .yaml file — no upload, no sign-up, and no watermark. YAML is the format most config files are written in.
Your data stays on your device. It is converted in your browser and never uploaded anywhere.
2 spaces is the usual YAML style; 4 spaces suits deeply nested files.
Minimal quoting keeps the output easy to read and still safe to parse.
The file fills the box above; nothing leaves your device.
Saved as .yaml — leave blank to use "converted.yaml".
How it works
JSON and YAML describe the same kind of data — names paired with values, nested inside each other — but they look very different. JSON is built for code: it uses curly braces, square brackets, commas, and quotes, so any programming language can parse it without guessing. YAML is built for people: it uses indentation and dashes instead of brackets, so a config file reads almost like an outline. That is why the same settings often exist in both forms, and why developers need to move between them. This converter reads the JSON and rebuilds it as YAML, keeping every value, every list, and every level of nesting intact.
The conversion follows the shape of your data. A JSON pair such as "name": "Alice" becomes a YAML line, name: Alice. A nested object becomes an indented block under its key, so "address": {"city": "Austin"} becomes address: on one line and city: Austin indented underneath. A JSON array becomes a YAML list with one dash per item, in the same order, so "tags": ["red", "blue"] becomes tags: followed by - red and - blue. Numbers stay numbers, true and false stay booleans, and JSON null becomes YAML null. An empty array becomes [] and an empty object becomes {}, so nothing is silently dropped.
Quoting is where YAML needs care, because a plain word can mean more than one thing. The word yes could be read as true, 123 as a number, and null as an empty value — so if your JSON string is "yes", the YAML must say "yes" in quotes, or a parser would turn it into a boolean. The same applies to a string with a colon, a hash, or leading or trailing spaces, which would confuse a YAML reader. Minimal quoting, the default, adds double quotes only in those cases, so ordinary words stay bare and easy to read. Always-quote wraps every string, which is the safest choice when the file will be read by a strict parser. Never-quote is offered for short, simple values, but it can change the meaning of strings like yes or 0123, so use it only when you know your values are plain words.
You control the shape of the output. Indentation offers 2 spaces, the usual YAML style, or 4 spaces, which suits deeply nested files where the levels need to stand out. Key order stays as you wrote it by default, or you can sort the keys A to Z, which makes comparing two config files much easier — matching keys line up. Paste JSON or upload a .json file; the converter updates live as you type if automatic conversion is on. Copy the result, or download it as a .yaml file.
Before anything is converted, the tool validates your input. If your JSON has a missing comma, an unclosed quote, or an extra bracket, it stops and shows a friendly message with the exact line and column where the problem is — for example, "line 3, column 12" — instead of producing broken YAML. Everything runs in your browser, so your data is never uploaded. The size bars beside the tool show the byte size of your JSON and the YAML it produces — YAML is usually a little smaller, because it drops the braces, brackets, and most of the quotes.
Worked example
Suppose you have a small user record in JSON and need it as YAML for a config file:
{"name": "Alice", "age": 30, "tags": ["red", "blue"], "address": {"city": "Austin", "active": true, "score": null}}
Step 1: paste the JSON into the input box, with the indentation on 2 spaces and quoting on Minimal.
Step 2: click Convert to YAML. The tool parses the JSON, checks it is valid, and walks through it one value at a time.
Step 3: the output is exactly this:
name: Alice age: 30 tags: - red - blue address: city: Austin active: true score: null
The page reports the sizes: the JSON is 115 bytes and the YAML is 96 bytes — 19 bytes smaller, about 17% — because the braces, brackets, and quotes are gone. Now try the quoting modes on a tricky value. Change the name to "yes" and convert again with Minimal quoting: the output says name: "yes", with quotes, because bare yes would be read as true. Always-quote quotes every string; Never-quote leaves yes bare, which is why that mode is not recommended. Turn on Sort keys and the top-level keys reorder to address, age, name, tags, with the nested keys inside address sorted too.
If you paste JSON with a mistake — say {"name": "Alice" "age": 30} with the comma missing — the tool does not guess. It shows a message like "Check line 1, column 18: a comma is expected here," so you can fix the one character and convert again.
FAQ
Is my JSON uploaded to a server?
No. Your JSON is parsed and converted entirely in your browser with a small hand-written YAML emitter. Nothing is uploaded anywhere, so private API responses, configuration files, and customer data stay on your own device.
When should I quote a string in YAML?
Quote a string when it could be read as something else — for example yes, no, true, null, a number such as 123, or a value containing a colon, a hash, or leading or trailing spaces. The minimal quoting mode adds quotes only in those cases; the always-quote mode quotes every string.
Does the converter keep the order of my keys?
Yes, by default the output keeps your keys in the same order they appear in the JSON. Turn on Sort keys if you would rather have the output alphabetically ordered, which is handy for comparing two config files.
How are arrays and nested objects converted?
A JSON array becomes a YAML list with one dash per item, in the same order. A nested object becomes an indented block under its key, so the structure is shown by indentation alone — no braces or brackets are needed.
What happens if my JSON has an error?
The tool checks your JSON before converting and shows a friendly message with the line and column where the problem is, for example a missing comma or an unclosed quote. Fix that spot and convert again — no broken YAML is produced.