Skip to content

YAML ↔ JSON Converter

Convert YAML to JSON and back, with anchors, merge keys and several documents handled.

YAML

Nothing is uploaded

JSON

The JSON appears here as you type.

Runs in your browser — nothing you enter leaves this device.

About this tool

What it does

YAML is how Kubernetes manifests, Docker Compose files, GitHub Actions and many app configs are written; JSON is what APIs, JavaScript and most validators expect. This converter turns one into the other as you type. It understands the parts of YAML that trip people up — anchors (&name) and aliases (*name), merge keys (<<:) that copy shared settings into several services, block strings, and files with several documents separated by ---, which become a JSON array. Going the other way, it writes clean YAML that quotes values such as yes, no and 011 so older YAML readers can’t misread them.

How to use it
  1. Choose YAML → JSON or JSON → YAML.
  2. Paste the file or snippet. The result updates as you type; errors show the line and column.
  3. Pick 2 or 4 spaces of indentation, and sort keys if you want a stable order for comparing files.
  4. Press the swap button to convert the result back, or copy it.
Limits and your data
  • YAML is read with the YAML 1.2 core rules. yes, no, on and off stay strings, and dates stay text rather than becoming timestamps, which matches modern parsers but not some YAML 1.1 tools.
  • Custom tags such as !Ref or !Sub (AWS CloudFormation) and !!js/function are not understood and are reported as errors; nothing in the file is ever executed.
  • Comments can’t be kept: JSON has no comments, so they’re dropped when converting to JSON.
  • Input is limited to 2 MB. A file whose anchors expand to more than 500,000 values when written out (an “alias bomb”) is stopped rather than freezing the page.
  • Conversion runs in your browser with the open-source js-yaml library. Your configuration — which often contains hostnames, keys and passwords — is never uploaded or stored.

Questions

Is JSON valid YAML?

Almost always. YAML 1.2 was designed so JSON documents are valid YAML, which is why the JSON → YAML direction rarely fails. The reverse isn’t true: YAML has comments, anchors and multiple documents that JSON can’t express.

What happens to anchors and merge keys?

They’re resolved. Every alias is replaced with a copy of the anchored value, and <<: merges the anchored mapping into the current one, with keys written directly in the mapping winning.

Why is my value “yes” quoted in the YAML output?

Older YAML 1.1 parsers — still used by some tools — read yes, no, on, off and y as booleans, and 011 as an octal number. Quoting keeps them as the strings they were in your JSON.

Can I convert a Kubernetes file with several resources?

Yes. Documents separated by --- become one JSON array, with one item per document.