Convert between YAML and JSON
YAML and JSON are the two most common formats for configuration and structured data. Kubernetes manifests, Docker Compose files, CI pipelines and OpenAPI specs are usually written in YAML, while APIs, JavaScript code and many tools expect JSON. This converter translates between them in both directions as you type, and tells you exactly what's wrong when the input isn't valid.
Features
- Two directions: YAML → JSON and JSON → YAML, with one-click switching.
- Syntax validation with clear error messages for bad indentation, unclosed quotes and invalid JSON.
- Multi-document YAML converted to a JSON array.
- Anchors, aliases and merge keys resolved automatically.
- 2 or 4 space indentation for the output.
- Copy or download the result as
.jsonor.yaml. - Private: nothing is sent to a server.
Example
This YAML:
name: web-app
replicas: 3
ports:
- 80
- 443
env:
NODE_ENV: production
converts to this JSON:
{
"name": "web-app",
"replicas": 3,
"ports": [80, 443],
"env": {
"NODE_ENV": "production"
}
}
Common YAML mistakes
- Tabs for indentation. YAML only allows spaces. Replace tabs with two spaces.
- Inconsistent indentation. Items that belong together must be indented by exactly the same amount.
- Missing space after the colon.
key:valueis read as a single string; writekey: value. - Special characters in strings. Values that start with
@,*,&,!,%,{or[, or contain:, need quotes. - Unexpected types. Version numbers like
1.10become the number 1.1, and leading zeros can be lost. Quote values that must stay text.
Related tools
Pretty-print or minify the resulting JSON with the JSON Formatter, turn JSON into a spreadsheet with JSON to CSV, or compare two configuration files with the Diff Checker.