DevToolCase
Sign in Sign in

Convert YAML to JSON

Turn a YAML file (Docker Compose, Kubernetes, CI settings…) into JSON, and find the exact line of an indentation error.

Share this result

Encrypted in your browser. The key stays in the link, after “#”: only the people you give it to can read it, not even DevToolCase.

The link works for

Sign in for longer links or links without expiry, and to find them in your account.

YAML 1.2: “yes”, “no” and dates stay text, as in most current tools. Comments are not kept in JSON.

Runs entirely in your browser: nothing you type is sent or stored.

Why convert YAML to JSON?

YAML is easy to write by hand, which is why Docker Compose, Kubernetes, GitHub Actions or OpenAPI use it. Programs and APIs read JSON: converting shows exactly how a YAML file is understood, and catches a mistake before a deployment fails.

The YAML traps the conversion reveals

  • Indentation: a key two spaces too far right becomes the child of the key above it.
  • Tabs: YAML only allows spaces to indent.
  • Unquoted values: version: 1.10 is the number 1.1; write "1.10" to keep the text.
  • The “Norway problem”: in YAML 1.1, NO meant false. This converter follows YAML 1.2, where NO, yes or on stay text.
  • Duplicate keys: refused, rather than the last one silently winning.

Several documents, anchors and aliases

A file holding several documents separated by ---, like a set of Kubernetes manifests, becomes a JSON array. Anchors (&base) and aliases (*base) are expanded into full copies.

The other way: JSON to YAML.

Add this browser’s favorites to your account?

This browser has 0 favorites that your account does not have:

Either way, this browser keeps its favorites: you find them again after signing out.