YAML to JSON Converter

Convert YAML to JSON, with errors that name the line.

Result

{
  "name": "Superwebkit",
  "private": true,
  "tools": [
    {
      "id": 1,
      "free": true
    },
    {
      "id": 2,
      "free": true
    }
  ],
  "tags": [
    "json",
    "yaml"
  ]
}
18 lines · 197 bytes
  • Anchors and aliases are resolved, and comments are dropped (JSON has none).

How does YAML convert to JSON?

YAML and JSON describe the same kinds of data: objects, lists, strings, numbers and true or false. YAML is written with indentation and is popular for config files. JSON is stricter and is what most APIs expect.

Converting reads the YAML structure and prints it as JSON. Anchors (&a) and aliases (*a) are filled in with their values, and comments are dropped because JSON has none. The sample config, with a name, a flag, two tools and tags, becomes a JSON object with the same fields.

How to use the YAML to JSON Converter

  1. Paste your YAML on the left.
  2. Choose a 2 or 4 space indent for the JSON.
  3. Read the JSON result, or the error with line and column.
  4. Copy or download the JSON.

Real situations

When people use the YAML to JSON Converter

  • 1

    Send a config to an API

    Many APIs take JSON only. Write the config in YAML for readability, then convert it before sending.

  • 2

    See what YAML really means

    Anchors and aliases can hide repeated data. Converting expands them, so you can see the final values.

  • 3

    Check Kubernetes or CI files

    See how a manifest or pipeline file is parsed, and find indentation mistakes with the line and column.

  • 4

    Convert multi-document files

    A file with several documents separated by --- becomes a JSON array with one item for each.

Good to know

  • Comments are lost, because JSON cannot hold them.
  • Use spaces for indentation. YAML does not allow tabs there.
  • Quote a value if you want it to stay text, such as "yes".

FAQ

YAML to JSON Converter: questions answered

Why are yes and no not booleans?

YAML 1.1 treated yes, no, on and off as booleans, which caused famous bugs, such as the country code NO turning into false. YAML 1.2, which this tool follows, only treats true and false as booleans, so a: yes becomes "yes" as text.

What happens to comments?

They are dropped, because JSON has no way to hold comments. If you need to keep them, use the YAML validator, which keeps comments while tidying the layout.

How are anchors and aliases handled?

An anchor marks a value, and an alias points back to it. The tool fills in the value each time. In c: &x 1 followed by d: *x, both c and d become 1 in the JSON.

What if my file has several documents?

Documents separated by --- are returned as a JSON array with one entry for each. For a: 1, then a line with ---, then b: 2, you get an array of two objects, and a note says so.

Why do I get a tab error?

YAML does not allow tab characters as indentation. The tool reports Tabs are not allowed as indentation with the line and column. Replace the tab with spaces.

Can I convert JSON back to YAML?

Yes, use the JSON to YAML converter. Remember that comments dropped here cannot be recovered, so keep your original YAML file.

Is this YAML to JSON Converter free and private?

Yes. It is free with no sign-in, and every calculation runs inside your browser. Nothing you type is sent to a server or stored, and the page keeps working offline once it has loaded.

Private by design. No accounts, no cookies, no tracking. Everything you type stays on your device.

How we keep it that way