Contact

Tools  /  JSON  /  JSON → YAML

JSON → YAML

Convert JSON into YAML with correct smart-quoting (numbers/booleans/dates/reserved words that look like other types get quoted), block or flow style, multi-line literal blocks, sort keys, and optional anchors for duplicate objects.

What this tool does

Paste JSON and get back YAML representing the same data — but with quoting decided correctly, not just "wrap every string," which is where a lot of converters quietly get it wrong.

The quoting bug most converters get wrong

YAML infers types from unquoted text: an unquoted no becomes the boolean false, an unquoted 1.0 becomes the number 1, and an unquoted 2026-01-01 becomes a date — even when the original JSON value was the string "1.0" or "no". A converter that quotes strings inconsistently can turn a version number or a status field into a different type the moment the YAML is read back. This tool checks every string against the actual rules that make YAML reinterpret it — reserved words, number-like and date-like patterns, leading YAML special characters, and more — and quotes only the ones that need it, so a round trip through YAML and back preserves the original value.

Handling multi-line strings properly

A string containing a newline can be forced into a single quoted line with an escaped \n, but that is hard to read once it is more than a sentence. With literal blocks turned on, a multi-line string instead uses YAML's own block scalar syntax (|), keeping it as actual readable lines in the output rather than one long escaped string.

Deduplicating repeated structures

When the exact same object or array appears more than once in the JSON, turning on anchors factors the first occurrence out with a named anchor and replaces every later occurrence with a reference to it, instead of repeating the same structure in full each time it shows up.

Privacy

Parsing and conversion both happen in your browser. Nothing you paste, drop, or load from a file is sent to a server.

Frequently asked questions

Is my data uploaded anywhere?
No. Parsing and conversion both run locally in the browser — nothing is sent to a server.
Why does a string like "no" or "1.0" need to be quoted in the output?
YAML treats certain unquoted text as a different type entirely — an unquoted no becomes the boolean false, and an unquoted 1.0 becomes a number, even though the original JSON value was a string. Quoting exactly the strings that trigger this keeps the value a string when the YAML is read back, instead of silently changing its type.
What are YAML anchors, and when does this tool use them?
An anchor names one occurrence of a structure so a later reference can point back to it instead of repeating it. This tool detects when the exact same object or array appears more than once in the JSON and, with the option turned on, uses an anchor for the first occurrence and a reference for every later one.
What is the difference between block and flow style?
Block style spreads objects and arrays across multiple indented lines, the way YAML is usually written by hand. Flow style writes them inline using brace and bracket syntax similar to JSON. A middle option applies flow style only to collections that hold nothing but plain values, keeping anything with nested structure in block style.
How are multi-line strings represented?
With literal blocks turned on, a string containing a newline is written using YAML's own block scalar syntax as actual multiple lines, rather than a single line with the newline escaped inside quotes.
Can I control how JSON null is represented in the YAML?
Yes — null can be written as the word null, as a tilde, or left blank, whichever convention fits the file it is going into.
Theme Accent