This free json to yaml works instantly in your browser — no sign-up, no downloads. Answer: Paste JSON and hit Convert. Objects become indented maps and arrays become dash lists, so {"name":"api","ports":[80,443]} turns into name: api, then ports: with - 80 and - 443 on their own lines. It runs in your browser on the yaml 2.9 engine and checks that the output parses back to the same data.
Bidirectional converter on the real yaml engine — running in your browser, not on a server
| JSON value | YAML output | Why |
|---|---|---|
"hello" | hello | Plain scalar — nothing ambiguous |
"true story" | true story | Whole-string match would be a boolean; a phrase never is |
"a: b" | "a: b" | colon-space is the key separator — must be quoted |
3.14, 42, -7 | 3.14, 42, -7 | Numbers pass through unchanged |
1e21 | 1e+21 | YAML's canonical exponent form |
true / false | true / false | 1:1 mapping |
null | null | Explicit null (also valid: ~) |
"" | "" | Empty string can't be a plain scalar |
[1, 2, 3] | - 1 lines | Block sequence, one dash per item |
{"a":{"b":"c"}} | indented map | Nesting becomes indentation |
"line1\nline2" | |- block | Block scalar replaces \n escapes |
"café ☕" | raw UTF-8 | No \u escapes — YAML is Unicode-native |
Every row is the actual output of the yaml 2.9 engine this page runs, not a paraphrase. The minimal-quoting behavior is the same serializer Ansible, Jest, and the AWS CDK use through this library.
JSON and YAML differ in surface, not in data model: both express null, booleans, numbers, strings, arrays, and objects. Converting is therefore two steps — parse to a real value, then serialize in the target syntax — and every subtle bug in naive converters comes from skipping the parse and rewriting text with regexes. This tool always round-trips through the data: JSON.parse → YAML.stringify one way, YAML.parse → JSON.stringify the other, on the eemeli/yaml engine loaded from a CDN and executed locally.
Indent changes nesting width (2 spaces is the Kubernetes and GitHub Actions convention; 4 is common in older configs). Line folding wraps long plain scalars at column 80 with a continuation indent — the 80-column habit comes from terminals and code review diffs — and can be turned off when every value must stay on one line, as some strict pipelines require. Both are passed straight to the serializer.
A service config in JSON: a name, a replica count, a nested metrics block with enabled and interval_sec, a two-port array, a null timeout, and an environments list of two objects. In JSON that's 397 bytes over 25 lines. Converted at 2-space indent it becomes 274 bytes of YAML over 16 lines — the ports collapse into dash items, the environments entries read as clean stanzas, and the null stays explicit. Parsing that YAML back yields a value deep-equal to the original JSON object, which the tool verifies on every run rather than assuming. Folding shows up on prose: a 164-character description string wraps into three folded lines at column 80 by default and stays on one line with folding off.
Going from YAML to JSON is where surprises happen, because YAML guesses types from how values look. We ran these through the same yaml 2.9 engine this page uses. The left column is the YAML you paste; the middle is what comes out in JSON:
| YAML input | JSON output | What to know |
|---|---|---|
country: no | "no" | String. YAML 1.2 dropped yes/no/on/off booleans |
on: push | "on" key | String key, which is what GitHub Actions expects |
version: 1.10 | 1.1 | A number, so the trailing zero is gone. Quote it |
zip: 01234 | 1234 | Leading zero lost. Quote codes and IDs |
mode: 0o755 | 493 | Octal read as a number; plain 0755 is decimal 755 |
date: 2026-10-22 | "2026-10-22" | Stays a string; no date type in the default schema |
time: 12:30 | "12:30" | String (YAML 1.1 parsers read 750) |
big: 12345678901234567890 | 12345678901234567000 | Beyond JavaScript number precision |
empty: or tilde: ~ | null | Both are null |
x: .inf | null | JSON has no Infinity, so it serializes as null |
&anchor / *alias | Copied values | Aliases are expanded into full copies |
<<: *base merge key | A literal "<<" key | Merge keys are YAML 1.1; not merged by default |
| Duplicate key | Error: DUPLICATE_KEY | Map keys must be unique |
| Tab used to indent | Error: TAB_AS_INDENT | YAML indentation is spaces only |
Two documents split by --- | Error: MULTIPLE_DOCS | Convert one document at a time |
# comments | Dropped | JSON has nowhere to keep them |
The three to watch are version numbers, leading zeros and anything that looks like a number but isn't one: ZIP codes, phone numbers, account IDs, git SHAs made of digits. YAML reads them as numbers and the formatting is lost before JSON ever sees it. Put them in quotes in the YAML and they come through as strings.
Comments are the other casualty. JSON has no comment syntax, so a round trip from YAML to JSON and back loses every one of them. Keep the YAML file as your source of truth and generate JSON from it, not the other way round.
This converter writes YAML 1.2, where no, yes, on and off are ordinary strings, so it leaves them unquoted. Many tools still read YAML 1.1, where those words are booleans. We converted JSON with those values and loaded the output in PyYAML 6.0.3, the parser Python projects and Ansible use:
| JSON in | YAML out (this converter) | What PyYAML reads |
|---|---|---|
{"country": "no"} | country: no | False |
{"on": "yes"} | on: yes | {True: True} |
{"o": "off"} | o: off | False |
{"t": "12:30"} | t: 12:30 | 750 (base-60 number) |
{"d": "2026-10-22"} | d: 2026-10-22 | A date object, not a string |
{"v": "1.10"} | v: "1.10" | "1.10" (correct, already quoted) |
The name comes from country lists, where Norway's code NO turned into false. If the file will be read by Python, Ansible or another YAML 1.1 tool, put quotes around any value that's yes, no, on, off, y, n, a time like 12:30 or a date you need as text. The YAML validator shows how a file parses, and the JSON formatter is handy for checking the JSON side before you convert.
Paste your JSON into the converter and it parses and re-serializes it as YAML entirely in your browser — no upload to any server. The conversion preserves nested objects, arrays, and scalar types exactly. Invalid JSON is flagged with a parse error so you can fix it before converting.
Usually yes, because YAML drops quotes, braces, and commas in favor of indentation, but not always. Very short values, deeply nested single-item arrays, and strings containing special characters can make YAML as long or longer than JSON. YAML also permits multiple equivalent renderings (flow vs block style) of the same data.
Everything in JSON maps to YAML cleanly except duplicate keys and certain edge-case numbers like leading-plus exponents, which YAML parsers may reject or normalize differently. YAML 1.1 vs 1.2 spec differences can also change how things like booleans (on/off/yes/no) are typed on round-trip. For config files this rarely matters, but strict round-tripping is not guaranteed.
Because unquoted 1.10 in YAML is a number, and numbers don't keep trailing zeros. The same happens to leading zeros, so 01234 becomes 1234. Quote the value in your YAML, version: "1.10", and it converts as the string "1.10".
YAML 1.1 parsers such as PyYAML treat yes, no, on and off as booleans. This converter writes YAML 1.2, where they're strings, so it leaves them unquoted. If an older parser will read the file, put those values in quotes.