Convert JSON to YAML

Paste any valid JSON document and get the matching YAML representation. The JSON to YAML converter parses your input, walks every key and value, and emits a 2-space indented YAML tree. Strings, numbers, booleans, null, arrays and nested objects each map to their YAML equivalent. The transform runs in your browser; nothing uploads.

Input
Line 1:1 LF cloud_done Saved locally
Result JSON to YAML
0 lines 0 chars

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

  1. 1Paste a valid JSON document into the input panel on the left.
  2. 2The YAML result appears in the output panel on the right as you type.
  3. 3Click Copy in the output header to copy the YAML.
  4. 4Click Download to save the result as a .yaml file.
  5. 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 FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun 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.

Input
{
  "site": "textresult",
  "tags": ["text", "tools"],
  "public": true,
  "owner": null
}
Output
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?
Yes. The converter walks the parsed object in the order the browser 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.
Can I get flow-style YAML instead of block style?
Not from this tool. The output is always block style with two-space indents because that is the dominant style in Kubernetes, GitHub Actions, Ansible, and most language ecosystems. If you need flow style, copy the result and rewrap manually.
What happens with very large numbers?
JavaScript parses numbers as IEEE-754 doubles, so integers above 2^53 lose precision at parse time. The converter cannot recover those digits. If you need exact large-integer round-trips, store the value as a JSON string and unwrap on the YAML side.
Is the JSON sent anywhere?
No. The parse and emit run entirely in your browser via JavaScript. Nothing is uploaded, nothing is logged, no record of your text exists on our servers.
How do I go the other way?
Paste your YAML into YAML to JSON. That converter parses YAML 1.2 and emits the matching JSON document.