How to use
- Click Paste to load YAML from your clipboard, or click Upload to open a .yaml, .yml or .txt file. For a file with several documents, open Options and set Multiple documents to JSON array.
- Set Output to Indent 2, Indent 4 or Minify.
- Smaller inputs convert as you type. For very large input (over 1,048,576 characters), click Convert or press Ctrl/Cmd+Enter.
- Click Download to save the JSON file.
Examples
Compose config with shared defaults
x-defaults: &defaults
restart: unless-stopped
environment:
LOG_LEVEL: info
services:
api:
<<: *defaults
image: example/api:1.4
worker:
<<: *defaults
image: example/worker:1.4
{
"x-defaults": {
"restart": "unless-stopped",
"environment": {
"LOG_LEVEL": "info"
}
},
"services": {
"api": {
"restart": "unless-stopped",
"environment": {
"LOG_LEVEL": "info"
},
"image": "example/api:1.4"
},
"worker": {
"restart": "unless-stopped",
"environment": {
"LOG_LEVEL": "info"
},
"image": "example/worker:1.4"
}
}
}OpenAPI response codes
responses:
200:
description: Order found
404:
description: Order not found
{
"responses": {
"200": {
"description": "Order found"
},
"404": {
"description": "Order not found"
}
}
}Two Kubernetes ConfigMaps as a JSON array
apiVersion: v1 kind: ConfigMap metadata: name: storefront-config data: LOG_LEVEL: info --- apiVersion: v1 kind: ConfigMap metadata: name: checkout-config data: PAYMENT_MODE: sandbox
[{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"storefront-config"},"data":{"LOG_LEVEL":"info"}},{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"checkout-config"},"data":{"PAYMENT_MODE":"sandbox"}}]How YAML types become JSON
| YAML | JSON | Note |
|---|---|---|
name: Alice, "02134" | string | Quoted numbers stay strings. |
30, 1.10, 0x1F, 12345678901234567890 | number | Written exactly as in the YAML; hex and octal become decimal. |
true, False | boolean | yes, no, on stay strings (YAML 1.2). |
null, ~, empty value | null | |
2001-12-14, 12:30:00 | string | No hidden conversion to timestamps. |
lists, maps, anchors, << merge keys | array, object | Aliases are expanded; key order is kept. |
.inf, .nan, !!binary, !Ref, list as a key | — | Error with the path and line, never a silent change. |
FAQ
Does converting YAML to JSON preserve large numbers?
The converter writes numbers such as 12345678901234567890, 1.10 and 1e3 exactly as written, without rounding. Hex and octal values become decimal, and forms such as +5 and .5 become valid JSON numbers.
Why do yes, on and dates stay strings?
Under the default YAML 1.2 rules, yes, no, on and off are strings, and dates such as 2001-12-14 also stay strings. A %YAML 1.1 directive switches that document to YAML 1.1 rules, where values such as yes become booleans.
Why does my YAML fail to convert to JSON?
Duplicate keys, custom tags such as !Ref, and values such as .inf or .nan stop conversion instead of silently changing your data. The error identifies the line and column; for syntax errors, use See all errors in YAML Validator → to inspect all errors.
Is my YAML uploaded or saved?
Conversion runs in your browser, and the tool sends no YAML or JSON in network requests. Input is not saved; option settings are saved locally, and opening another tool temporarily passes the data through sessionStorage, which the destination removes after reading.
How large a YAML file can I convert?
Files and pasted input above 10 MB are rejected. Files must be UTF-8 text; nesting is limited to 1,000 levels and alias expansion to 1,000,000 values.