JSON to YAML Converter

Convert JSON to YAML and back, both directions, entirely in your browser.

Convert JSON to YAML and YAML back to JSON, in either direction, entirely inside your browser. Useful when you are moving between an API that speaks JSON and infrastructure tooling — Kubernetes, Docker Compose, GitHub Actions, Ansible — that expects YAML. Your configuration is never uploaded, which matters when it contains hostnames, ARNs or environment details.

Direction

YAML is a superset of JSON, so every valid JSON document is already valid YAML — the conversion is about readability, not capability. Anchors, aliases and multi-document YAML are parsed but flattened on the way to JSON, which has no equivalent for them.

JSON input
YAML output

How JSON to YAML Converter works

YAML and JSON describe the same thing — nested maps, lists and scalars — with very different syntax. YAML is in fact a superset of JSON: every valid JSON document is already valid YAML, which is why converting between them is about readability and tooling conventions rather than capability.

Going from JSON to YAML replaces braces and brackets with indentation, drops the quotes around keys and most strings, and turns arrays into dash-prefixed lists. The result is typically 30% shorter and considerably easier to scan, which is why the infrastructure world settled on it. Going the other way adds all that structure back, which is what you want when feeding a config into code, a JSON-only API, or a schema validator.

A few things do not survive the round trip cleanly, and it is better to know them upfront. YAML anchors and aliases (`&name` and `*name`) let you define a block once and reuse it; JSON has no equivalent, so they are expanded into duplicated content. Multi-document YAML files — several documents separated by `---`, common in Kubernetes manifests — have no JSON counterpart either, so only the first document converts. Comments are lost in both directions, because neither JSON nor the parser's output model retains them.

YAML also has a famous sharp edge worth remembering: unquoted `yes`, `no`, `on` and `off` were treated as booleans in YAML 1.1, which is how the "Norway problem" got its name — the country code `NO` silently becoming `false`. Modern parsers follow YAML 1.2 and treat them as strings, but older tooling may not, so quoting such values is still the safe habit.

Conversion runs locally using js-yaml, the same parser most JavaScript tooling uses, loaded on demand only on this page.

How to use JSON to YAML Converter

1

Choose a direction

JSON → YAML or YAML → JSON. Switching direction feeds the current result back in, so you can round-trip without retyping.

2

Paste your document

Paste the text or open a .json, .yaml or .yml file from your device.

3

Copy or download

Take the converted result to your clipboard, or download it with the right file extension.

Frequently Asked Questions

Is YAML really a superset of JSON?
+
Yes. Since YAML 1.2, every valid JSON document is also valid YAML, so a YAML parser will happily read JSON. The conversion here is about producing idiomatic, readable YAML rather than making it parseable.
Are my config files uploaded?
+
No. The conversion runs in your browser with js-yaml. Nothing is sent to a server, which matters because config files often contain internal hostnames, account IDs and environment details.
What happens to comments?
+
They are lost. Neither JSON nor the parsed object model has anywhere to store them, so comments cannot survive a conversion in either direction. Copy any important ones across by hand.
Does it handle YAML anchors and aliases?
+
They are parsed correctly, but since JSON has no equivalent they are expanded into duplicated content rather than preserved as references.
Can it convert multi-document YAML?
+
Only the first document. A file with several documents separated by --- has no single JSON equivalent, so convert each document separately if you need them all.
Why did my YAML value "NO" turn into false?
+
That is the classic YAML 1.1 boolean trap — yes/no/on/off were treated as booleans. Modern parsers follow YAML 1.2 and keep them as strings, but quoting such values is still the safest habit for older tooling.
Which indentation does the YAML output use?
+
Two spaces per level, the near-universal convention in Kubernetes, Docker Compose and GitHub Actions. YAML forbids tabs for indentation entirely.
Is this tool free?
+
Yes — free, no sign-up, no watermark, no limits. It runs on your device, so there is no server cost to recover.

Related tools