YAML to JSON Converter

Convert YAML to JSON with anchors resolved, multi-line strings joined correctly and quoted scalars kept as strings.

YAML
JSON
Runs locally in your browser

About the YAML to JSON Converter

YAML is a superset of JSON in spirit but has features JSON lacks: anchors and aliases, multi-line block scalars, comments, several ways to write the same boolean, and multiple documents in one file. This converter handles each: anchors are expanded, block scalars become single strings with the right newlines, comments are dropped, and a multi-document file becomes a JSON array with one element per document.

Typing follows the YAML 1.2 core schema, so yes and no are strings rather than booleans (unlike YAML 1.1 parsers such as older PyYAML), 010 is the number 10 rather than octal 8, and anything quoted stays a string. If your source was written for a 1.1 parser, review boolean-like values after conversion.

Common uses are turning a Compose or Kubernetes file into JSON for a tool that only reads JSON, feeding config into a JavaScript app, or simply checking what a YAML parser will see. The reverse converter takes you back, and the validator explains parse errors in more detail.

How to use

  1. Paste YAML on the left or upload a file.
  2. Pick the indent for the JSON output.
  3. Copy the JSON. Swap sends it to JSON to YAML.

Common questions

What happens to YAML anchors and aliases?
Aliases are replaced with the anchored content, so the JSON contains the full data in every place it was referenced.
How are multi-line strings converted?
Literal blocks (|) keep their newlines; folded blocks (>) are joined with spaces, exactly as the YAML spec defines.
Why is my date now a string?
JSON has no date type. Timestamps are emitted as ISO 8601 strings.
Can I convert a file with several documents?
Yes. The output is an array with one element per document.