How to convert YAML to JSON online
Paste YAML, such as a docker-compose file, a GitHub Actions workflow or a Kubernetes manifest, and the JSON appears with 2-space indentation, ready to copy or download. If the YAML is invalid, the error gives the line and column.
# YAML
name: CodingAnthem
tools:
- JSON Formatter
- Base64
# JSON
{
"name": "CodingAnthem",
"tools": ["JSON Formatter", "Base64"]
}How YAML values become JSON
- The converter follows YAML 1.2, so
yes,no,onandoffstay strings; onlytrueandfalsebecome booleans. Older YAML 1.1 tools treat them as booleans. ~andnullbecomenull. Numbers become numbers:0755is 755, while0o755is octal, 493. Quote values like"007"to keep them as text.- Dates such as
2026-11-27stay strings, since JSON has no date type. .infand.nanhave no JSON equivalent and come out asnull.- Block text with
|keeps line breaks;>folds lines into one. - Anchors and aliases (
&name,*name) are expanded into full copies. - Merge keys (
<<: *defaults), common in docker-compose and CI files, copy the anchored keys into the mapping. Keys written in the mapping itself win, and<<: [*a, *b]merges several.
Common YAML errors
- Tabs: YAML indentation must use spaces. "Tabs are not allowed as indentation" means a tab was found.
- Inconsistent indentation, such as a key indented under a value on the same line, gives "Nested mappings are not allowed in compact mappings".
- Duplicate keys in the same mapping are an error rather than being silently overwritten.
- Files with several documents separated by
---aren't supported. Convert one document at a time.
To go the other way, use JSON to YAML. To check or tidy the result, use the JSON Formatter.