How to use
- Paste YAML on the left, or click Load sample.
- Choose the JSON indentation. The result updates as you type.
- Fix any error shown — the message includes the line.
- Copy or download the JSON.
Options explained
- Anchors and aliases
- &name defines a reusable block and *name inserts it. In JSON the referenced content is copied in full.
- Multi-line strings
- | keeps line breaks, > folds lines into spaces. Both become ordinary JSON strings with \n where the line breaks are kept.
- Duplicate keys
- YAML forbids the same key twice in one mapping, but many parsers silently keep the last one. This converter reports it as an error so the mistake is not hidden.
Example
YAML:
defaults: &defaults
retries: 3
timeout: 30
production:
<<: *defaults
timeout: 60
JSON:
{
"defaults": { "retries": 3, "timeout": 30 },
"production": { "retries": 3, "timeout": 60 }
}
Frequently asked questions
Why do I get an error about indentation?
YAML uses indentation for structure, and tabs are not allowed. Make sure items in the same list or mapping start in the same column, using spaces only.
What happens to comments?
JSON has no comments, so they are dropped.
How are yes/no and on/off converted?
This converter follows YAML 1.2, where only true and false are booleans; yes, no, on and off stay strings. Older YAML 1.1 parsers (including PyYAML) treat them as booleans, so quote them if the file is shared.
Can it convert multiple documents separated by ---?
Yes. Each document becomes one element of a JSON array, in order.
Privacy
This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.