Answer: The JSON ⇄ YAML on ToolAspect gives you the answer instantly — free, no signup, and it runs entirely in your browser.
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.
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.