toolo.dev

YAML to JSON Converter

Convert YAML to JSON online: anchors, merge keys and multi-document files work, big integers stay exact, and errors show the line and column of the problem.

Swap: JSON to YAML

Several documents separated by --- become a JSON array. Dates stay as text.

Paste YAML on the left, or load the sample, to see the JSON.

About the YAML to JSON

Convert YAML to JSON and see exactly what a parser reads from your file. Anchors and merge keys are expanded, several --- documents become one JSON array, big integers keep every digit, and errors give the line and column of the problem.

You'll need this when an API, a CLI flag or a test only takes JSON, or when a config file behaves oddly. Is NO a string or false? Did the merge key copy the right settings? The JSON answers that, and it lets you run jq on a long Kubernetes file.

The converter follows YAML 1.2 with the core schema, plus the << merge key that Compose and CI files use. That means no and on stay strings and dates stay text. Your YAML is converted in the browser, so internal hostnames and other config details don't leave your machine.

  1. Paste YAML into YAML Input, or click Load sample for a settings file with a comment, a date, an anchor and a multi-line string.
  2. Read the result under JSON Output; it follows each edit you make to the YAML. If the YAML can't be parsed, an Invalid YAML box shows the reason with its line and column.
  3. Pick 2 spaces or 4 spaces in the Indent menu.
  4. Press Sort keys to order object keys from A to Z at every level. Big integers stay exact either way.
  5. Take the JSON with Copy, or Download gives you converted.json.
  6. Click Swap: JSON to YAML to go the other way.