PlayTools

JSON to YAML Converter

Convert JSON to block-style YAML in your browser, with a choice of indent and optional key sorting. Strings are quoted only when ambiguous.

Runs in your browser — nothing you enter is uploaded

The YAML uses block style with your chosen indent. Strings are quoted only when they would otherwise be ambiguous (looking like a number, boolean or null). Repeated objects are written out in full rather than as anchors and aliases. Since every JSON value is valid YAML, the conversion never loses data. Runs entirely in your browser.

Advertisement

Turning JSON into a readable YAML config

YAML earns its place in config files by being easy to read and edit: no braces, no quotes on ordinary strings, indentation instead of punctuation, and comments allowed. Kubernetes manifests, GitHub Actions workflows, Docker Compose files and countless tool configs all use it. Converting a JSON payload, API response or exported settings blob into YAML is often the first step in turning it into something a human maintains.

Because every JSON value is also a valid YAML value, the conversion is lossless — the data that comes out is exactly the data that went in, just written in block style with your chosen indentation. A top-level object becomes a mapping, a top-level array becomes a sequence of "- " items, and a bare value is emitted as-is.

Quoting is applied conservatively. A string is left bare unless doing so would change its type: "123", "true", "null", "3.14" and date-like strings get quotes so YAML does not silently reinterpret them as a number, boolean, null or timestamp. Everything else stays unquoted, which is what makes the output pleasant to read.

The "sort keys" option alphabetises every object's keys, which is handy for producing a stable file that diffs cleanly when the source key order is arbitrary. Repeated objects are written out in full rather than collapsed into anchors and aliases — more verbose, but easier to follow and safer to hand-edit.

The JSON is parsed and the YAML generated locally with js-yaml. Nothing is uploaded.

These free tools pair well with this page — open them in a new tab to finish your workflow.

Advertisement

Frequently Asked Questions

Why convert JSON to YAML?

YAML is easier to read and edit by hand — no braces, no quotes on most strings, comments allowed — which is why config files for CI, Kubernetes, Docker Compose and many tools use it. Converting a JSON payload or API response to YAML is a common first step when turning it into a config.

Does the conversion lose anything?

No. Every JSON value is a valid YAML value, so the data round-trips exactly. The output uses block style with your chosen indentation.

When are strings quoted in the output?

Only when leaving them bare would change their meaning — a string like "123", "true", "null" or "2024-01-01" is quoted so YAML does not read it as a number, boolean, null or date. Ordinary text is left unquoted.

What does "sort keys" do?

It orders the keys of every object alphabetically in the output. This is useful for producing a stable, diff-friendly file when the source JSON key order is arbitrary.

Are repeated objects turned into anchors?

No. The converter writes every occurrence out in full rather than emitting &anchor / *alias references, which keeps the YAML straightforward to read even though it can be more verbose.

Can it handle a top-level array?

Yes. A JSON array at the top level becomes a YAML sequence (a list of "- " items). Any valid JSON — object, array, or a bare value — is accepted.

Does anything leave my browser?

No. The JSON is parsed and the YAML generated locally with js-yaml. Nothing is uploaded.