JSON ↔ YAML Converter
Convert between JSON and YAML formats. Switch direction with the toggle then click Convert.
Input Section
JSON input
Output Section
Converted output
YAML result
What is JSON ↔ YAML conversion?
JSON (JavaScript Object Notation) and YAML (YAML Ain't Markup Language) both represent hierarchical data — objects, arrays, strings, numbers, booleans, and null — but with very different syntax philosophies. JSON uses braces, brackets, and explicit quotes everywhere, making it easy to parse mechanically. YAML uses indentation and minimal punctuation, making it considerably more readable for humans. Both formats are widely used in configuration files, APIs, and data exchange.
When to use JSON vs YAML
- JSON is the right choice for machine-to-machine communication (REST APIs, database documents, browser storage) because it is universally supported, unambiguous, and faster to parse.
- YAML is preferred for configuration files that humans read and edit frequently — Docker Compose, Kubernetes manifests, GitHub Actions workflows, Ansible playbooks — because its indentation-based structure is easier to scan without the noise of quotes and braces.
- Both formats represent the same data model. A JSON object directly corresponds to a YAML mapping, a JSON array to a YAML sequence, and scalar types map 1-to-1.
How to use this tool
- Select the conversion direction using the toggle: JSON → YAML or YAML → JSON.
- Paste your input into the editor on the left.
- Click Convert.
- Copy the result from the output panel on the right.
YAML syntax quick reference
| YAML | JSON equivalent |
|---|---|
key: value | {"key": "value"} |
count: 42 | {"count": 42} |
enabled: true | {"enabled": true} |
- item1 | ["item1", "item2"] |
nested: | {"nested": {"child": "value"}} |
null_val: ~ | {"null_val": null} |
Common pitfalls when converting
- YAML reserved words —
yes,no,on,offare treated as booleans in some YAML parsers. Quote them explicitly if you mean the literal strings. - Indentation — YAML uses spaces, never tabs. Mixed indentation causes parse errors.
- Multi-line strings — YAML block scalars (
|for literal,>for folded) have no JSON equivalent and are flattened to a single string during conversion. - Duplicate keys — JSON technically forbids duplicate keys; YAML allows them but parsers usually keep only the last value. The converter will pass through the first definition.
- Comments — YAML supports
#comments; JSON does not. Comments are stripped during YAML→JSON conversion.