YAML ↔ JSON Converter
Convert between YAML and JSON instantly, in either direction.
About this tool
Convert YAML to JSON or JSON to YAML, instantly and in your browser. Useful when a config file, a Kubernetes manifest, or a CI pipeline is in one format and a tool, an API, or a colleague wants the other. Nothing is uploaded.
YAML and JSON hold the same data. Both describe a tree of maps, lists, strings, numbers, booleans, and null. In fact every valid JSON document is also valid YAML — YAML is (almost) a superset. The difference is surface syntax: JSON uses braces, brackets, and quotes; YAML uses indentation and dashes, allows comments, and lets you skip most quotes.
Example
name: micro-tools
public: true # unquoted booleans
tags:
- fast
- free
build:
minify: true
target: dist {
"name": "micro-tools",
"public": true,
"tags": ["fast", "free"],
"build": { "minify": true, "target": "dist" }
} Indentation and dashes become brackets and braces; the # comment is dropped (JSON has none).
Why convert. YAML is easier for a human to read and edit (config files, infrastructure-as-code); JSON is easier for machines to parse and is what most APIs speak. Converting lets you author in YAML and ship JSON, or take a JSON response and read it comfortably.
Indentation is structure in YAML. The number of leading spaces defines nesting, so a misaligned line changes the meaning or breaks the parse. Tabs are not allowed for indentation — a stray tab is one of the most common YAML errors. Keep it to two spaces per level and be consistent.
The "Norway problem" and friends. YAML interprets unquoted scalars, and some are surprising: no, off, and false all become boolean false; yes, on, true become true; null, ~, and an empty value become null; 3.0 becomes a number, not the string "3.0". A country code list containing NO (Norway) can silently become false. When you need a literal string that looks like one of these, quote it. Converting JSON to YAML here quotes such strings automatically so the round trip is safe.
What this converter doesn't handle. Anchors and aliases (&name / *name), custom tags, and multi-document files separated by ---. It covers everyday YAML: nested maps, sequences, flow collections ([a, b], {k: v}), quoted and plain scalars, and comments (which are dropped, since JSON has none).
To validate or reformat the JSON side, use the JSON formatter (and the JSON guide for its grammar). For tabular data, the CSV ⇄ JSON converter; for XML, the XML formatter.
Frequently asked questions
- Does this support YAML anchors and aliases?
- No. It handles everyday YAML — nested mappings, sequences, flow collections, scalars, and comments — but not anchors, aliases, custom tags, or multi-document files.
- Why does converting JSON to YAML quote some strings?
- Strings that YAML would otherwise read as a number, boolean, or null (like "3.0", "yes", "no", "null") are quoted so the YAML parses back to the same value.
- My YAML won't parse — what's the usual cause?
- Almost always indentation: a tab character (never allowed), inconsistent spaces, or a line indented to the wrong level. Use two spaces per level.
- Is every JSON document valid YAML?
- Effectively yes — modern YAML is a superset of JSON, so you can paste JSON into the YAML side and it converts.
- Are comments preserved?
- Going YAML → JSON, no — JSON has no comments, so they're dropped. Going JSON → YAML there are none to begin with.
- Is my data uploaded anywhere?
- No. Parsing and conversion happen entirely in your browser.