Converters & Dev

YAML to JSON

Paste YAML and get JSON, or paste JSON and get YAML. Mistakes are reported with the line they are on, which is usually all you need to fix an indentation slip.

Your document

Result

Top-level keys
—
Lines out
—

Two ways of writing the same thing

YAML and JSON describe exactly the same kind of data. JSON is strict and unambiguous, which is why machines send it; YAML has no brackets and allows comments, which is why configuration files use it. Converting between them is a daily job when you work with Docker Compose, Kubernetes, GitHub Actions or OpenAPI.

The traps in YAML

How to use the converter

  1. Pick a direction — YAML to JSON, or JSON to YAML.
  2. Paste the document. Errors appear with the line number, which is nearly always an indentation problem.
  3. Choose the indent — two spaces is the convention for YAML, and minified JSON is there for config fields that want one line.

What is lost on the way

Privacy

The parsing runs in your browser. Configuration files often contain hostnames, keys and internal addresses, so it matters that none of it is uploaded. The YAML library is fetched from a CDN once and then everything happens locally.

Frequently asked questions

How do I convert YAML to JSON?

Paste the YAML above with the direction set to "YAML to JSON". The result appears as you type, and any syntax error is reported with its line number.

Why does my YAML fail to parse?

Nearly always indentation: a tab instead of spaces, or a line indented one space too far. The error message gives the line — check the lines just above it as well.

Do comments survive the conversion?

No. JSON has no comment syntax, so they are dropped going to JSON and cannot be recreated coming back. Keep the original YAML if the comments matter.