JSON to YAML, plain and predictable
JSON to YAML conversion takes a structured JSON document and rewrites it as YAML 1.2-compatible source. Object keys become block-style mapping keys. Arrays become block-style sequences with a leading - on each item. Numbers and booleans pass through bare; strings are quoted only when YAML would otherwise misread them (leading punctuation, embedded colons, reserved tokens like true, yes, on or numeric-looking values). The converter parses the JSON with the browser native JSON.parse, so the input must be valid JSON.
Indentation is fixed at two spaces, which matches the YAML 1.2 recommendation and is the dominant style in Kubernetes manifests, GitHub Actions workflows, and most Ruby and Python tooling. Nested mappings indent one level per depth. Empty objects render as {}, empty arrays render as [], and explicit null renders as null. Order of keys is preserved exactly as the JSON parser returned them.
If the JSON is invalid, the output panel shows the parser message instead of YAML so you can fix the source. For the inverse direction, see YAML to JSON. If you want comma-separated rows out of a JSON array of records, see JSON to CSV.
How to use convert json to yaml
- 1Paste a valid JSON document into the input panel on the left.
- 2The YAML result appears in the output panel on the right as you type.
- 3Click Copy in the output header to copy the YAML.
- 4Click Download to save the result as a
.yamlfile. - 5If the input is invalid JSON, fix the message shown in the output and the YAML will refresh.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run a saved workflow Plus |
What this tool actually does
Strict JSON parse via the browser engine
The input is parsed with JSON.parse, which means trailing commas, single-quoted strings, comments and unquoted keys are rejected. The error message from the engine is shown in the output panel so you can locate the offending character.
Block-style YAML, two-space indent
Mappings render one key per line. Sequences render with a leading hyphen and space on each item. Indentation uses two spaces per nesting level. The output is valid YAML 1.2 and parses cleanly in PyYAML, ruamel.yaml, go-yaml v3, and js-yaml.
Smart quoting for strings
Strings are emitted bare when safe and quoted with double quotes when the value could collide with a YAML scalar tag. That includes values that look numeric, the literals true, false, yes, no, on, off, null, the empty string, and any value containing a colon followed by a space, a leading hash, or a leading dash.
Booleans, null, numbers pass through bare
JSON true, false and null render as YAML true, false and null. Integers and IEEE-754 floats render in the same digit form the JSON parser returned. Very large numbers stay as decimal text rather than getting rewrapped to scientific notation.
Runs entirely in your browser
No upload, no server-side processing, no log of what you pasted. Every keystroke triggers a fresh parse and emit. Documents up to a few megabytes convert in under a second on a desktop browser.
Worked example
Object keys become mapping keys, the array becomes a block sequence, true and null stay bare.
{
"site": "textresult",
"tags": ["text", "tools"],
"public": true,
"owner": null
}
site: textresult tags: - text - tools public: true owner: null
Settings reference
| Behaviour | Effect on output |
|---|---|
| JSON parse | Strict JSON.parse. Trailing commas, comments and single quotes are rejected. |
| Indentation | Two spaces per nesting level. Block style only. |
| Object keys | Order preserved as the parser returned them. Quoted only when the key would collide with a YAML token. |
| Arrays | Render as block sequences with - prefix per item. Empty arrays render as []. |
| Strings | Bare when safe, double-quoted when the scalar could be misread (numeric-looking, boolean-looking, leading # or -, contains : ). |
| Booleans and null | true, false, null render bare. |
| Numbers | Render in the same digit form the JSON parser returned. |
| Invalid JSON | The parser message is shown in the output panel; no partial YAML is emitted. |
FAQ
Does it preserve key order?
JSON.parse returned. Modern engines (V8, SpiderMonkey, JavaScriptCore) preserve insertion order for string keys, so your YAML keys come out in the same order as the JSON.