How to convert YAML to JSON
- Paste YAML or open a
.yamlor.ymlfile. The JSON appears as you type. - Pick the JSON Indent: 2 spaces, 4 spaces or tabs.
- Press ⇄ to send the JSON to JSON to YAML.
A mistake in the YAML shows the line to fix instead. The YAML validator shows the same message beside your code and can re-indent the file.
Several documents become an array
Documents separated by ---, as in many Kubernetes manifests:
apiVersion: v1
kind: Service
metadata:
name: api
spec:
ports:
- port: 80
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
replicas: 3
become one array, with a note saying how many were found:
[
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "api"
},
"spec": {
"ports": [
{
"port": 80,
"targetPort": 8080
}
]
}
},
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "api"
},
"spec": {
"replicas": 3
}
}
]
YAML 1.2, not 1.1
YAML 1.1 read many plain words as booleans and dates; this converter follows YAML 1.2. Compared with PyYAML, a YAML 1.1 parser:
| YAML | JSON here | PyYAML |
|---|---|---|
country: NO |
"NO" |
False |
debug: off |
"off" |
False |
on: push |
key "on" |
key True |
released: 2026-11-05 |
"2026-11-05" |
a date |
mode: 0755 |
755 |
493 (octal) |
version: 1.10 |
1.1 |
1.1 |
So a GitHub Actions on: key stays "on". The last row catches both: an unquoted version number is a float, and 1.10 loses its zero.
What JSON cannot hold
Comments are dropped, since JSON has no comments, and .inf and .nan become null. Large results are easier to browse in the JSON viewer.