JSON to YAML Converter
Paste any valid JSON and this tool prints the same data as YAML, using a 2-space indent and no line wrapping so long strings stay on one line. It handles objects, arrays, deep nesting and bare scalars like a single number or quoted string. Everything runs in your browser, so the data you paste is never uploaded.
How to convert JSON to YAML
- Paste or type your JSON into the 'JSON input' box, or click 'Load sample' to try a nested example.
- Watch the 'YAML output' box below fill in automatically as you type.
- If the input is not valid JSON, read the red error message and fix the quote, comma or brace it names.
- Click Copy to put the YAML on your clipboard.
- Or click Download to save it as data.yaml.
Examples
Object with a string array
{"name":"Ada","roles":["admin","dev"]}name: Ada roles: - admin - dev
Nested object with booleans (the built-in sample)
{"name":"Ada","role":"Engineer","active":true,"skills":["systems","math"],"manager":{"name":"Linus","id":7}}name: Ada role: Engineer active: true skills: - systems - math manager: name: Linus id: 7
Numbers, false and null
{"port":8080,"debug":false,"tags":null}port: 8080 debug: false tags: null
Frequently asked questions
What is the difference between JSON and YAML?
Both describe the same data shapes: maps, lists, strings, numbers, booleans and null. JSON marks structure with braces, brackets and commas, while YAML uses indentation and dashes, which many people find easier to scan and hand-edit. JSON is stricter and dominates APIs; YAML is common for config files.
How is the YAML indented and wrapped?
Each nesting level is indented by 2 spaces, and line wrapping is disabled, so a long string is never broken across lines. That keeps the output stable and diff-friendly, which matters for config files checked into git.
Does it handle nested objects and arrays?
Yes. Objects become YAML maps and arrays become dash-prefixed sequences, nested to any depth. The built-in sample shows a nested manager object and a skills array converted in one pass.
Can I convert a bare value that is not an object?
Yes. A lone number, quoted string, boolean or null is valid JSON, so 42 converts to 42 and "hi" converts to hi. Whole arrays at the top level also work and become a sequence of dash lines.
What happens if my JSON is invalid?
The tool tries to parse the input and, if it fails, shows an 'Invalid JSON' message with the parser's reason, such as an unexpected token. The output box stays empty until the JSON parses cleanly, so a trailing comma or a single quote will block it.
Are comments kept in the conversion?
No. JSON has no comment syntax, so there is nothing to carry over, and the YAML holds only your data. YAML does support comments with the # character, so you can add them to the output yourself afterward.
Does the key order change?
No. Keys are emitted in the same order they appear in your JSON object, not sorted alphabetically. What you paste top to bottom is what you get top to bottom.
Is my data uploaded anywhere?
No. Parsing and conversion happen entirely in your browser with a local library, so your JSON never leaves your device. That makes it safe for config that contains internal names or secrets.
How do I go the other way, from YAML back to JSON?
Use the YAML to JSON converter, linked under related tools. It reverses the process and is handy when a service or API expects JSON but your config lives in YAML.
Learn more
- JSON vs YAML: when to convert and why
How JSON and YAML map to the same data, where each format shines, and what to watch for when you turn one into the other for config files.
Related tools
YAML to JSON
Convert YAML to JSON online. Paste YAML and get clean, pretty-printed JSON with the indentation you choose. Runs entirely in your browser.
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
Air Fryer Converter
Convert any conventional oven recipe to air fryer settings. Lower the temperature by 25 F and cut the cook time by about 20 percent automatically.
Baker's Percentage Calculator
Turn a bread formula into grams with baker's percentages. Flour is 100 percent, enter water, salt and yeast percents to get weights and hydration.
Baking Pan Converter
Swap one baking pan for another and scale the batter to fit. Compares pan areas for round, square and rectangular pans and gives a batter scale factor.
Binary to Decimal
Convert binary to decimal online. Paste any binary number, with or without spaces, and get the exact base-10 value instantly. Runs in your browser.