Convert YAML to JSON Online

Convert YAML to JSON online: paste your YAML code or upload a .yaml or .yml file, press Convert, and get the same data in JSON format. Anchors and merge keys are expanded, and a file with several documents becomes a JSON array. The conversion runs in your browser, and nothing is uploaded to the Internet. It's free.

About Online YAML to JSON Converter

The YAML to JSON Converter reads YAML and writes the same data in JSON format. Use it on a Kubernetes manifest, a docker-compose file, an OpenAPI spec or a CI config when a program or an API accepts only JSON.

  • Convert YAML to indented JSON or minify it to one line
  • Expand anchors, aliases and << merge keys
  • Convert a file with several documents into a JSON array
  • Highlight YAML syntax errors with a built-in YAML linter
  • View the JSON as a tree
  • Upload a .yaml or .yml file and download the JSON as a .json file
  • Free to use

What is the difference between YAML and JSON?

YAML is a superset of JSON, and the same data can be presented in both formats. JSON has no comments, so the conversion drops them. JSON marks structure with braces and brackets and puts every string in double quotes. YAML marks it with indentation, allows comments, and can reuse a block of values through anchors. A YAML file is usually smaller than the same data in formatted JSON: it has no braces, commas or quotes around most strings.

How to convert YAML to JSON online?

Paste your YAML code, or press Upload to open a .yaml or .yml file, then press Convert for indented JSON or Minify for JSON on one line. Copy the result or press Download to save it as data.json. To indent the JSON with tabs or another width, open it in the JSON Formatter. Invalid YAML is not converted: the result lists every syntax error with its line and column, as the YAML Validator does.

YAML to JSON Example

The anchor &defaults holds settings that the merge key << copies into web. In the JSON, web gets those keys, and the comment is gone.

YAML Input
# shared settings
defaults: &defaults
  restart: always
  retries: 3
services:
  web:
    <<: *defaults
    image: nginx:1.27
    debug: no
    ports:
      - 8080

JSON Result
{
    "defaults": {
        "restart": "always",
        "retries": 3
    },
    "services": {
        "web": {
            "restart": "always",
            "retries": 3,
            "image": "nginx:1.27",
            "debug": "no",
            "ports": [8080]
        }
    }
}

YAML to JSON Conversion Rules

  • true and false become booleans; yes, no, on and off stay strings.
  • Numbers become JSON numbers: 1.10 becomes 1.1, and 0777 becomes 777. Quote a value to keep it as a string.
  • A date such as 2026-11-11 stays a string.
  • An empty value becomes null.
  • Tags are dropped and their values kept: !Ref MyBucket becomes "MyBucket".
  • Several documents become an array; a file of comments only becomes null.
  • .nan and .inf become null: JSON has no such numbers.
Updated: