How to use the YAML to JSON Converter
- Paste your YAML into the left box, or click Load sample.
- The JSON appears on the right as you type. Choose 2 or 4 spaces, and tick Sort keys if you like.
- If there's an error, click Go to line to jump to it.
- Click Copy to copy the JSON.
YAML vs JSON
| YAML | JSON | |
|---|---|---|
| Structure | Indentation (spaces only, never tabs) | Braces {} and brackets [] |
| Comments | Yes, with # | No |
| Quotes | Usually optional | Required around keys and strings |
| Multiple documents | Yes, separated by --- | One value per file |
| Used for | Config: Docker Compose, Kubernetes, GitHub Actions, Ansible | APIs, data exchange, package.json |
Every JSON document is also valid YAML 1.2, so YAML parsers can read JSON directly. Going the other way loses comments, because JSON has no place for them.
Common YAML gotchas
- Tabs: YAML doesn't allow tab characters for indentation. Use spaces.
- Unquoted surprises:
on,yesandnoare plain strings in YAML 1.2 (which this tool follows), but older YAML 1.1 parsers read them as true or false. Quote them to be safe, like"yes". - Colons in values: a value like
time: 12:30or a URL with:may need quotes. - Leading zeros:
zip: 01234may be read as a number. Quote codes, IDs and version numbers like"3.10".
Frequently asked questions
What happens to YAML comments?
They're removed, because JSON has no comments.
What about anchors and aliases (& and *)?
They're expanded, so each place that used an alias gets a full copy of the value in the JSON.
How are dates converted?
Unquoted dates like 2026-10-24 become ISO date strings in JSON. Quote them in the YAML to keep them exactly as written.
Is my data uploaded?
No. The conversion runs in your browser with the open-source js-yaml library.