YAML Validator & YAML ↔ JSON Converter
Check YAML for errors and convert between YAML and JSON
Loading the tool…
Finds YAML syntax errors with their line and column, and converts between YAML and JSON in both directions. Use it to see why a YAML file such as a Docker Compose, Kubernetes or CI configuration does not load, or to move JSON data into YAML.
How to use
- Paste YAML into the "YAML" box on the left or press "Open file". The "JSON" box updates at once, and "Valid YAML" or "YAML error" is shown.
- For an error, read the cause and the hint, then press "Go to the line". If tabs were used for indentation, press "Replace tabs with spaces".
- To turn JSON into YAML, paste the JSON into the right box. "Indentation", "Sort keys" and "Multiple documents ↔ JSON array" change the result.
- Download the result with "Save .yaml" or "Save .json".
How it works
- The YAML is read with the js-yaml library (MIT licence) and follows the YAML 1.2 core schema. Values that older YAML 1.1 parsers read differently get a separate warning.
- "Re-indent YAML" rewrites the YAML, so its comments are removed.
- Everything is converted in this browser. Nothing you type is saved or sent anywhere. Files over 30 MB cannot be opened.
Questions and answers
- Can I use tabs for indentation in YAML?
- No. YAML allows only spaces for indentation. When tabs are found, the error is shown together with a "Replace tabs with spaces" button.
- Why does YAML turn no or yes into true or false?
- YAML 1.1 parsers read yes, no, on and off as true or false. In YAML 1.2 only true and false are booleans, but the safest way to keep the word as text is to quote it, as in "no".
- Why do values like 0755 or 1.10 change?
- Without quotes they are read as numbers, so leading or trailing zeros disappear. Quote postcodes, version numbers and file modes that must stay as written.
- Does YAML need a space after the colon?
- Yes. A key and value are written as key: value, with a space after the colon. Without the space, key:value is read as one string.