JSON to YAML Converter
Convert a JSON document into clean, readable YAML.
Option 2: Or upload your JSON file
Ctrl + Enter
Result
JSON to YAML conversion
Every JSON document is also a valid YAML document (YAML 1.2 is a superset of JSON), but nobody wants to read JSON braces in a configuration file. This converter parses your JSON and re-emits it in block style YAML: indentation instead of braces, one array item per line prefixed by -, and strings quoted only when necessary.
Mapping table
| JSON | YAML | Notes |
|---|---|---|
{"a": 1, "b": 2} | a: 1 b: 2 | Objects become mappings; property order is preserved (unless "Sort keys" is checked). |
{"list": [1, 2, 3]} | list: - 1 - 2 - 3 | Arrays become block sequences; with "Use flow style for short arrays": list: [1, 2, 3]. |
[{"id": 1}, {"id": 2}] | - id: 1 - id: 2 | Arrays of objects. |
"hello world" | hello world | Plain strings are left unquoted. |
"true", "123", "null", "1.10" | 'true', '123', 'null', '1.10' | Strings that would be read back as another type are quoted automatically so the round trip is lossless. |
"a: b", "#hash", " padded " | 'a: b', '#hash', ' padded ' | Strings containing YAML indicators or leading/trailing spaces are quoted. |
"line 1\nline 2" | |- line 1 line 2 | Multi-line strings use the literal block style. |
42, -3.5, 1e21 | 42, -3.5, 1e+21 | Numbers are written as-is. |
true / false | true / false | |
null | null | |
{}, [] | {}, [] | Empty containers use the flow notation. |
"2024-05-01" | '2024-05-01' | Quoted, because unquoted dates are timestamps in YAML. |
Example
Input JSON:
{
"name": "FreeFormatter",
"version": "2.0",
"tags": ["json", "yaml"],
"server": { "host": "localhost", "port": 8080, "tls": false },
"notes": null
}
Output YAML:
name: FreeFormatter
version: '2.0'
tags:
- json
- yaml
server:
host: localhost
port: 8080
tls: false
notes: null
Options: "Quote all strings" wraps every string in double quotes (useful for tools that treat unquoted values loosely), "Lenient JSON parsing" accepts JavaScript-style input (comments, single quotes, trailing commas), and "Sort keys" orders the mapping keys alphabetically at every level.