How to convert YAML to JSON
- Paste your YAML (or a
.ymlfile’s contents) into the left box. - The JSON appears instantly on the right. Choose 2 or 4-space indentation.
- Copy or download the result. Switch to JSON → YAML to go the other way.
YAML vs JSON
| YAML | JSON | |
|---|---|---|
| Syntax | Indentation-based, minimal punctuation | Braces, brackets and quotes |
| Comments | Yes (#) | No |
| Readability | Very human-friendly | Machine-friendly, still readable |
| Common uses | Docker Compose, Kubernetes, GitHub Actions, Ansible, OpenAPI | APIs, package.json, config files, databases |
| Superset? | YAML 1.2 is a superset of JSON | — |
Things to watch out for
- Indentation matters: YAML uses spaces, never tabs. A misaligned line changes the structure — the error message shows the line and column.
- Comments are lost when converting to JSON, since JSON has no comment syntax.
- Unquoted values such as
yes,no,onor1.10may be read as booleans or numbers in some parsers. Quote them to keep them as strings. - Multiple documents separated by
---are converted to a JSON array. - Anchors and aliases (
&and*) are expanded into full copies.
Need to tidy the JSON further? Use the JSON formatter. Working with spreadsheets? Try the CSV to JSON converter.
Frequently asked questions
Is YAML a superset of JSON?
Yes — YAML 1.2 is designed so that any valid JSON document is also valid YAML.
Why do I get an indentation error?
YAML uses spaces for nesting. Check that items at the same level line up and that no tabs are used.
Are YAML comments kept?
No. JSON has no comments, so they are dropped when converting to JSON.
Is my data uploaded?
No. The conversion runs entirely in your browser.