About Online YAML to JSON Converter
The YAML to JSON Converter reads YAML and writes the same data in JSON format. Use it on a Kubernetes manifest, a docker-compose file, an OpenAPI spec or a CI config when a program or an API accepts only JSON.
- Convert YAML to indented JSON or minify it to one line
- Expand anchors, aliases and
<<merge keys - Convert a file with several documents into a JSON array
- Highlight YAML syntax errors with a built-in YAML linter
- View the JSON as a tree
- Upload a .yaml or .yml file and download the JSON as a .json file
- Free to use
What is the difference between YAML and JSON?
YAML is a superset of JSON, and the same data can be presented in both formats. JSON has no comments, so the conversion drops them. JSON marks structure with braces and brackets and puts every string in double quotes. YAML marks it with indentation, allows comments, and can reuse a block of values through anchors. A YAML file is usually smaller than the same data in formatted JSON: it has no braces, commas or quotes around most strings.
How to convert YAML to JSON online?
Paste your YAML code, or press Upload to open a .yaml or .yml file, then press Convert for indented JSON or Minify for JSON on one line. Copy the result or press Download to save it as data.json. To indent the JSON with tabs or another width, open it in the JSON Formatter. Invalid YAML is not converted: the result lists every syntax error with its line and column, as the YAML Validator does.
YAML to JSON Example
The anchor &defaults holds settings that the merge key << copies into web. In the JSON, web gets those keys, and the comment is gone.
YAML to JSON Conversion Rules
trueandfalsebecome booleans;yes,no,onandoffstay strings.- Numbers become JSON numbers:
1.10becomes1.1, and0777becomes777. Quote a value to keep it as a string. - A date such as
2026-11-11stays a string. - An empty value becomes
null. - Tags are dropped and their values kept:
!Ref MyBucketbecomes"MyBucket". - Several documents become an array; a file of comments only becomes
null. .nanand.infbecomenull: JSON has no such numbers.