How to use
Paste YAML into the top box — JSON appears below. Pick the format: 2- or 4-space indent, or minified on one line. If the YAML has an error, you’ll see where it is — line and column — and what’s wrong; the YAML validator lists every error at once.
Everything runs in your browser; nothing is uploaded.
What happens in conversion
- Comments are dropped — JSON has none.
- Anchors and aliases (
&base,*base) and merge keys<<: *baseare expanded into full copies of the values — the way Docker Compose, GitLab CI and most tools read them. - Multiple documents separated by
---become a JSON array, one element per document. - Values follow YAML 1.2:
noandonstay strings,0755is the number 755,2024-01-15is a string..infand.nancan’t be written in JSON, so they becomenull.
Example
defaults: &defaults
restart: always
web:
<<: *defaults
image: nginx
ports: ["80:80"]
becomes
{
"defaults": { "restart": "always" },
"web": { "restart": "always", "image": "nginx", "ports": ["80:80"] }
}
FAQ
Why didn’t no become false? In the current YAML 1.2 standard only true and false are booleans. yes, no, on and off were booleans in YAML 1.1 but are plain strings now.
What does an error with a line number usually mean? Most often indentation: YAML uses spaces for nesting, and one space too many or too few changes the structure. Tabs aren’t allowed in indentation.
What about large numbers? Integers above 2⁵³ (longer than 15–16 digits) lose precision in JavaScript. If they’re IDs, quote them in the YAML so they stay strings.
How do I convert back? Use the JSON to YAML converter.