YAML to JSON converter

Convert YAML to JSON and back.

FreeRuns in your browserNo signupUpdated 2026-10-29

Switching direction moves the current output into the input, so you can round-trip. Comments and anchors are not preserved.

Status

Converted

Root value

Object (3 keys)

Top-level type of the data

output.json
{
  "version": "3.9",
  "services": {
    "web": {
      "image": "nginx:1.27",
      "ports": [
        "80:80"
      ],
      "environment": {
        "NODE_ENV": "production",
        "DEBUG": false
      }
    },
    "db": {
      "image": "postgres:16",
      "volumes": [
        "db-data:/var/lib/postgresql/data"
      ]
    }
  },
  "volumes": {
    "db-data": {}
  }
}

Values such as yes, no, on and off are plain strings under YAML 1.2, which js-yaml follows. Older YAML 1.1 parsers would read them as booleans.

About this tool

How it works and how to read the result.

Need this done for you?

Web app & SaaS development

SaaS products and web apps, from first version to scale.

See the service

What it does

The YAML to JSON converter turns a YAML document into JSON, or JSON back into clean YAML, as you type. It handles nested mappings, sequences, multi-line strings and quoted scalars, and uses the YAML 1.2 rules of the js-yaml library, so values like yes and NO stay strings. Files that contain several documents separated by --- become a JSON array. A parse error reports the line and column so a stray tab or a wrong indent is quick to find. Config files from Docker Compose, GitHub Actions, Kubernetes and OpenAPI all convert in the browser without being uploaded.

How to use it

  1. Choose the direction: YAML to JSON or JSON to YAML.
  2. Paste the file. A Compose file, a workflow or an OpenAPI spec are typical.
  3. Pick an indent of two or four spaces for the output.
  4. Copy the result or download it. Switching direction moves the output into the input, so you can edit the JSON and convert it back.

How to read the result

The root value card tells you what the parser saw at the top level. A Compose file with version, services and volumes shows "Object (3 keys)". If you expected an object and see "Array (2)", the file contains two documents or starts with a list item, which is common in Kubernetes manifests joined with ---.

Check types in the output, not just shape. A port written as 80:80 without quotes is parsed by some YAML versions as a base-60 number; in the example above it is quoted, so it comes out as the string "80:80". A version written as 3.9 unquoted becomes the number 3.9, which older Compose releases reject, so the sample quotes it.

A parse error at line 9, column 5 usually points at the first line whose indent is inconsistent with the one above, or at a value containing a colon that needed quotes.

For config-heavy deployment work see our web app development service. To validate the JSON side on its own use the JSON formatter.

Questions

Frequently asked.

Why is "yes" a string and not true?

The converter follows YAML 1.2, where only true and false are booleans. YAML 1.1 parsers, still used by some older tools, treat yes, no, on and off as booleans, which is the cause of the well-known Norway problem where the country code NO becomes false. Quote such values to be safe.

Are comments and anchors kept?

No. JSON has no comments, so they are dropped when converting to JSON, and converting back cannot recreate them. Anchors and aliases are resolved into plain copies of the data. If you round-trip a config file, expect to re-add comments.

What does the indentation error mean?

YAML uses spaces to express structure, so a key indented two spaces more than its siblings starts a new nested mapping and a tab character is an error. The message shows the line and column; look at the lines just above for a mismatched indent.

Your next move

Like what you see? Tell us about it.

A process that takes too long, a website that undersells you, or an idea ready to take shape. Tell us where you are and we will suggest a useful next step.

India · Working with clients worldwide

We reply within a working day. No spam, ever.