YAML to JSON converter: convert YAML to JSON online

Convert YAML to formatted or minified JSON. Anchors and merge keys are expanded, multiple documents become an array, errors show the line and column.

Need the other way? JSON → YAML

How to use

Paste YAML into the top box — JSON appears below. Pick the format: 2- or 4-space indent, or minified on one line. If the YAML has an error, you’ll see where it is — line and column — and what’s wrong; the YAML validator lists every error at once.

Everything runs in your browser; nothing is uploaded.

What happens in conversion

Example

defaults: &defaults
  restart: always
web:
  <<: *defaults
  image: nginx
  ports: ["80:80"]

becomes

{
  "defaults": { "restart": "always" },
  "web": { "restart": "always", "image": "nginx", "ports": ["80:80"] }
}

FAQ

Why didn’t no become false? In the current YAML 1.2 standard only true and false are booleans. yes, no, on and off were booleans in YAML 1.1 but are plain strings now.

What does an error with a line number usually mean? Most often indentation: YAML uses spaces for nesting, and one space too many or too few changes the structure. Tabs aren’t allowed in indentation.

What about large numbers? Integers above 2⁵³ (longer than 15–16 digits) lose precision in JavaScript. If they’re IDs, quote them in the YAML so they stay strings.

How do I convert back? Use the JSON to YAML converter.