YAML ↔ JSON Converter

Supports common YAML: nested maps, lists, strings, numbers, booleans and null. Advanced features like anchors, tags, or multi-document files are not supported.

How to use this YAML/JSON converter

  1. Choose the direction: "YAML → JSON" or "JSON → YAML".
  2. Paste your source data into the left box.
  3. The converted result appears on the right instantly.

Why convert between YAML and JSON?

YAML is popular for human-edited config files (Docker Compose, Kubernetes, CI pipelines) because it's easy to read, while JSON is the universal format for APIs and data interchange. This converter helps move data between the two without manual rewriting.

Does this support YAML anchors and references?

No, this covers the common subset of YAML (nested maps, lists, scalars) used in most config files, not advanced features like anchors (&) and aliases (*) or custom tags.

What indentation does YAML require?

YAML uses spaces only (never tabs) for indentation, and consistent indentation within a block is required — mixing space counts at the same level will cause a parsing error.

What YAML anchors and aliases actually do, and why they're genuinely useful

As the FAQ above notes, this tool doesn't support YAML anchors and aliases, but understanding what these specific features actually accomplish helps explain both their genuine value and why they're a meaningfully more advanced feature than typical basic config files actually need. An anchor (marked with &) labels a specific block of YAML content so it can be referenced again later, and an alias (marked with *) then reuses that exact same labeled content elsewhere in the same document without needing to duplicate and retype it. This is genuinely useful in larger, more complex configuration files where the same specific block (like a common set of environment variables, or a shared resource-limit configuration) needs to appear identically in several different places — anchors and aliases let that shared content be defined exactly once and then referenced repeatedly, rather than being copy-pasted and duplicated throughout the file, which would otherwise create a real risk of those duplicated copies silently drifting out of sync with each other over time as the file gets edited.

YAML's infamous whitespace and type-inference gotchas

YAML's design deliberately prioritizes clean human readability over the more rigid, unambiguous strictness of a format like JSON, and that specific tradeoff has produced some genuinely well-known, real pitfalls. Because YAML uses indentation itself to represent nested structure rather than explicit brackets, mixing tabs and spaces, or simply using an inconsistent number of spaces at the same nesting level, causes a real parsing error — exactly as this tool's own FAQ above warns. A separate, famous, and genuinely real gotcha, often nicknamed the "Norway problem," comes from certain older YAML parsers automatically interpreting the unquoted country code "NO" as the boolean value false, rather than as the literal two-letter text string "NO" — because early YAML specification versions defined an unusually broad set of words (yes, no, on, off, true, false, and several more) as recognized boolean values. This exact ambiguity is precisely why explicitly quoting any string value that could otherwise be misinterpreted this way ("NO" rather than bare NO) is considered a genuinely important, standard defensive best practice when writing YAML by hand.

Why valid JSON is (almost) always valid YAML too

YAML was deliberately designed as a superset of JSON, meaning essentially any syntactically valid JSON document is also simultaneously valid YAML, parseable correctly by any proper, spec-compliant YAML parser without needing any actual conversion or modification at all. This genuinely useful compatibility relationship is precisely why this tool's JSON-to-YAML conversion direction is fundamentally about reformatting into YAML's more compact, minimal, bracket-free syntax for improved human readability, rather than about any kind of fundamental structural or semantic transformation between two genuinely incompatible formats — the actual underlying represented data itself doesn't change at all in the conversion, only its surface-level textual syntax and visual presentation does.

Why config-file formats specifically gravitated toward YAML over plain JSON

As the article above notes, tools like Docker Compose, Kubernetes, and many CI/CD pipeline systems specifically chose YAML as their primary configuration format, and this preference reflects real, genuine, practical advantages for the specific use case of a human directly hand-editing a configuration file. YAML natively supports inline comments (using #), which JSON's strict specification simply doesn't allow at all — a genuinely significant practical difference for any file real humans are expected to read, understand, and directly edit by hand themselves. YAML also eliminates JSON's comparatively noisier punctuation (no requirement for curly braces, square brackets, or trailing commas at every single level), relying instead on indentation to represent structure, which most people who work with it regularly find genuinely faster and cleaner to both read and hand-write directly compared to equivalent, functionally identical JSON.

Limitations of this tool

As the disclaimer and FAQ above both note, this tool supports the common, widely used subset of YAML — nested maps, lists, and scalar values (strings, numbers, booleans, and null) — entirely within your browser. It doesn't support more advanced YAML features like anchors and aliases (described above), custom tags, or multi-document files (multiple separate YAML documents combined together within one single file, separated by "---"). For configuration files using any of these specific advanced features, a dedicated YAML library with full specification support is needed instead of this tool, which is deliberately scoped and optimized for the common, everyday config-file subset most real-world YAML files actually use in practice.