YAML to JSON Converter
Turn YAML configuration — docker-compose files, Kubernetes manifests, GitHub Actions workflows or OpenAPI specs — into JSON, and find YAML syntax errors by line and column.
Result
Paste YAML to convert it to JSON.
How to use this tool
- Paste YAML. It is converted as you type.
- Choose formatted or minified JSON.
- Choose YAML 1.1 for older files where yes, no, on and off mean true and false.
- A file with several documents separated by
---becomes a JSON array, or choose to convert only the first. - Errors show the line and column, such as wrong indentation or a duplicate key.
How it works
The YAML is parsed with the well-tested open-source yaml library (ISC licence), which follows the YAML 1.2 specification, and written out as JSON. Anchors (&name) and aliases (*name) are expanded, and << merge keys are applied. Duplicate keys are reported as errors, because JSON objects cannot hold them reliably.
Where JSON cannot represent a YAML value exactly, the result explains what happened: .inf and .nan become null, YAML 1.1 dates become ISO 8601 text, keys that are lists or maps become JSON text, and integers too large for JavaScript are written with every digit.
Example
Anchors and merge keys
base: &b
a: 1
child:
<<: *b
c: 2
becomes {"base": {"a": 1}, "child": {"a": 1, "c": 2}}.
YAML 1.1 versus 1.2
enabled: yes gives "yes" (a string) in YAML 1.2 and true in YAML 1.1.
Privacy and limitations
- Everything runs in your browser; nothing you paste is uploaded or stored.
- Comments are dropped because JSON has none.
- Aliases can expand to at most 100 copies per document, which blocks “billion laughs” files designed to freeze the browser.
- Custom tags (such as !Ref in CloudFormation) are reported as warnings and converted as plain values.
Frequently asked questions
Why does my YAML give an indentation error?
YAML uses indentation to show structure, and tabs are not allowed for indentation. Check that items at the same level line up exactly with spaces; the error shows the line and column.
Can it convert JSON to YAML?
Yes — use the JSON to YAML Converter.