YAML to JSON converter

Convert YAML to JSON, including anchors, merge keys and multiple documents.

YAML

JSON

Waiting for input

What you get

How each result is checked

  1. Your YAML is parsed strictly as YAML 1.2: duplicate keys and syntax errors are rejected with the line number.
  2. The JSON output is parsed back and compared with the parsed YAML, value by value.

What can't convert exactly

  • Anchors (&), aliases (*) and merge keys (<<) are expanded into full copies, because JSON has no references.
  • Comments and custom tags such as !Ref are not data, so they are not carried over. You get a warning when this happens.
  • Several documents separated by --- become one JSON array.

Questions

Does it support docker-compose and CI files with << merge keys?

Yes. Merge keys are applied, so the JSON shows the final merged values.

Why is "yes" still a string?

In YAML 1.2, "yes" and "no" are strings. Only true and false are booleans.

Can I convert docker-compose or Kubernetes YAML to JSON?

Yes. Open the .yml or .yaml file or paste it: docker-compose files, Kubernetes manifests (several documents separated by --- become a JSON array) and anchors with merge keys all convert. Custom tags such as !Ref are named in the result.

How do I convert YAML to JSON online?

Paste your YAML or open a file on the left (or click Example). The JSON appears on the right as you type, already checked. Copy it, or download it as a file. Nothing is uploaded.

Can the JSON output be wrong?

Every result is checked before it is shown (the checks are listed on this page). If a check fails, the page says "Review needed" and why, instead of presenting the output as correct, and anything that cannot convert exactly is named in the notes.