How to use the JSON to YAML Converter
- Paste your JSON into the left box, or click Load sample.
- The YAML appears on the right as you type. Pick the indentation and whether to sort keys.
- Click Copy and paste it into your .yml or .yaml file.
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
Why are some strings quoted?
Values that YAML would otherwise read as something else, like "yes", "123" or text with a colon, are quoted so they stay strings.
Can I convert invalid JSON?
No. Fix it first with the JSON formatter, which can repair trailing commas and quotes automatically.
Is my data uploaded?
No. Everything runs in your browser.