How to convert YAML to JSON
- Paste YAML into the left panel, drag a
.yamlor.ymlfile onto it, click upload (up to 5 MB) or use Load from URL. - JSON appears on the right as you type. Use Tree to browse nested sections or Code for the text; the indent dropdown sets 2, 3 or 4 spaces or tabs.
- If the YAML is invalid, the error bar shows the line, the column and a pointer to the offending character. Typical causes are tabs used for indentation, an unclosed
[or{, and tags the JSON schema does not know. - Click Copy or Download .json.
What the output looks like
Input:
app: inventory
replicas: 3
features:
- search
- export
database:
host: db.internal
port: 5432
ssl: true
owner: null
Output:
{
"app": "inventory",
"replicas": 3,
"features": ["search", "export"],
"database": {
"host": "db.internal",
"port": 5432,
"ssl": true
},
"owner": null
}
A multi-document file converts to an array:
name: api
---
name: worker
[{ "name": "api" }, { "name": "worker" }]
Limits and notes
- Files up to 5 MB. Everything runs in your browser; nothing is sent to a server.
- Typing follows the JSON schema of YAML: lowercase
null,true,falseand plain decimal numbers (including1e3) are typed.~,Null,True,yes,on,NO,0x1f,1_000,010,.inf, dates and timestamps all stay strings. An empty value becomes""; see null vs undefined in JSON for how to treat it downstream. - Tags are not supported. Custom tags such as
!customand even built-in ones such as!!timestampraise an error. Remove the tag or quote the value. - Aliases are copied in full. JSON has no references, so a value used three times appears three times. Merge keys (
<<) are not expanded. - Key order is preserved. Comments are dropped because JSON has none.
- Dates stay as the text you wrote. JSON date format explains why ISO 8601 strings are the safe choice.
- Need the reverse? Use JSON to YAML. To compare the formats for configuration files, read JSON vs YAML.