YAML ↔ JSON Converter
Convert between YAML and JSON, with automatic type inference and support for nested objects and arrays.
How to use the YAML ↔ JSON Converter
- Paste YAML into the left panel to generate matching JSON on the right, or paste JSON into the right panel to generate matching YAML on the left.
- Or click Upload above the YAML panel to load a
.yamlor.ymlfile from your device instead of pasting. - Both panels stay live and editable — keep typing in either one and the other updates automatically a moment after you stop.
- Copy or download either panel's contents with its dedicated buttons.
See it in action
Given this YAML:
name: Ada
age: 30
active: true
tags:
- algorithms
- math
address:
city: London
zip: "EC1A 1BB"
The converter produces:
{
"name": "Ada",
"age": 30,
"active": true,
"tags": [
"algorithms",
"math"
],
"address": {
"city": "London",
"zip": "EC1A 1BB"
}
}
Notice age became a real number, active became a real boolean, tags became a JSON array, and address became a nested JSON object — all preserved directly, since JSON and YAML share the same underlying data model.
How This Tool Works
Whichever panel you edit drives the other: typing or pasting in the YAML panel parses it and generates matching JSON on the right, and typing (or pasting) JSON generates matching YAML on the left — there's no separate convert button or mode switch. Nothing you paste is ever sent to a server; parsing and generation both run entirely in your browser.
Unlike a flat CSV row, YAML naturally supports nested objects and arrays at any depth, and those convert both ways without any flattening step — a mapping under a key becomes a JSON object, a sequence becomes a JSON array, at any nesting level.
YAML scalar types map directly onto their JSON equivalents: an unquoted true/false becomes a JSON boolean, null or ~ becomes JSON null, and an unquoted number becomes a JSON number — while a quoted value like "EC1A 1BB" stays a string, exactly as YAML itself already distinguishes them. Note that an unquoted leading-zero number (e.g. 007) is parsed as a number like any other unquoted number, not preserved as a string — quote it in your YAML source if you need it kept as text. The one numeric case with no direct JSON equivalent is .inf, -.inf, or .nan — JSON has no way to represent infinity or "not a number" as a number, so these convert to the plain text Infinity, -Infinity, or NaN instead (with a warning banner), rather than silently becoming indistinguishable from JSON null.
YAML comments (anything after a #) aren't preserved in the JSON output, since JSON has no comment syntax — a warning banner tells you this only when your input actually contains one, so it never shows for comment-free YAML.
YAML anchors and aliases (&name / *name) are automatically expanded to their full referenced value in the JSON output — the JSON always contains the complete, resolved data, never a dangling reference. This includes `<<: *name` merge keys (common in Docker Compose and CI config files that share settings across services/jobs via a base anchor) — the merged-in keys land directly on the target object, not as a literal `"<<"` key. The one exception is a self-referencing alias (an anchor whose value contains an alias back to itself), which JSON has no way to represent — this shows a clear error instead of an infinite structure.
This converter accepts a single YAML document at a time. A file containing multiple `---`-separated documents (common in Kubernetes manifests that bundle several resources in one file) isn't supported and shows an error rather than silently converting only the first one.
An input with no real content — just comments, or a lone `---` document marker with nothing after it — is still valid YAML for an empty document, and converts to JSON null, the same as if you'd explicitly written a ~. This is different from leaving the panel fully empty, which shows a prompt to paste data instead of running a conversion at all.
The rarely-used `!!set` and `!!omap` tags (and `!!binary`) don't have a native JSON equivalent, so they're converted to the closest plain JSON shape instead — a `!!set` becomes a JSON array of its members, an `!!omap` becomes a JSON object with the same key order, and `!!binary` becomes an array of byte values. A warning banner tells you when this happened, since the original type's own semantics (uniqueness, insertion-order guarantees, "this was binary") aren't representable in JSON even though the underlying data is fully preserved.