Skip to content

YAML to JSON Converter

Turn YAML configs into strict JSON with exact numbers and clear errors.

Output
Options
Runs in your browser — your data is not uploaded.

How to use

  1. 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.
  2. Set Output to Indent 2, Indent 4 or Minify.
  3. Smaller inputs convert as you type. For very large input (over 1,048,576 characters), click Convert or press Ctrl/Cmd+Enter.
  4. Click Download to save the JSON file.

Examples

Compose config with shared defaults

Input
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
Output
{
  "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

Input
responses:
  200:
    description: Order found
  404:
    description: Order not found
Output
{
    "responses": {
        "200": {
            "description": "Order found"
        },
        "404": {
            "description": "Order not found"
        }
    }
}

Two Kubernetes ConfigMaps as a JSON array

Input
apiVersion: v1
kind: ConfigMap
metadata:
  name: storefront-config
data:
  LOG_LEVEL: info
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: checkout-config
data:
  PAYMENT_MODE: sandbox
Output
[{"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

YAMLJSONNote
name: Alice, "02134"stringQuoted numbers stay strings.
30, 1.10, 0x1F, 12345678901234567890numberWritten exactly as in the YAML; hex and octal become decimal.
true, Falsebooleanyes, no, on stay strings (YAML 1.2).
null, ~, empty valuenull
2001-12-14, 12:30:00stringNo hidden conversion to timestamps.
lists, maps, anchors, << merge keysarray, objectAliases 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.