Skip to content
SyntaxSnap

YAML to JSON Converter

Paste YAML or drop a .yml file to get JSON. When the YAML is broken, the error says what is wrong in plain words and highlights the line, so you can fix indentation problems quickly. One of our free JSON tools.

YAML

436 B

JSON

How to convert YAML to JSON

  1. Step 1

    Paste the YAML

    Paste it or drop a .yaml or .yml file.

  2. Step 2

    Fix any errors

    Errors explain the problem in plain words and highlight the line in the input.

  3. Step 3

    Copy the JSON

    Copy it, download data.json, or send it to JSON to TypeScript.

Worked example

The <<: *d merge copies timeout into job, the on key stays the string "on", and the date stays text.
Input: YAML with an anchor and merge key
on:
  push:
    branches: [main]
defaults: &d
  timeout: 30
job:
  <<: *d
  node: 22
  date: 2026-10-22
Output: JSON
{
  "on": {
    "push": {
      "branches": [
        "main"
      ]
    }
  },
  "defaults": {
    "timeout": 30
  },
  "job": {
    "timeout": 30,
    "node": 22,
    "date": "2026-10-22"
  }
}

Errors you can act on

YAML depends on indentation, and parser errors are often cryptic. This converter turns the most common ones into plain advice and points to the line and column, which are also highlighted in the input. A tab used for indentation is reported as exactly that, because YAML only allows spaces. A key that does not line up with its neighbours is reported as bad indentation. A key used twice in the same mapping, a quoted string that is never closed, and a key that runs onto a second line each get their own message. Click Show in input to jump to the spot.

Which values become which types

The converter follows the YAML 1.2 core schema. true and false are booleans, null, ~ and empty values are null, and values written as numbers become numbers, including 0x1F hex and 0o17 octal. Everything else is a string. That matters for words that YAML 1.1 treated as booleans: here yes, no, on and off stay strings. So the on: key at the top of a GitHub Actions workflow becomes "on", as GitHub intends, not true.

Dates are kept as the text you wrote. JSON has no date type, and converting 2026-10-22 into a timestamp would add a time and time zone that were never in the file.

Anchors, aliases and merge keys

YAML lets you define a block once with &name and reuse it with *name, and merge one mapping into another with <<: *name. Docker Compose files and CI configs use this to share settings between services or jobs. JSON has no references, so every alias is expanded into a full copy of the value, and merged keys appear directly in the target object. Keys written in the target win over merged ones.

Several documents in one file

A YAML file can hold several documents separated by ---, as Kubernetes manifests often do. A single document becomes one JSON value; several become a JSON array with one item per document, in order. Comments are not part of the data and are dropped.

After converting

Send the JSON to JSON to TypeScript to type a config, to JSON to Zod to validate it at runtime, or back through JSON to YAML after editing it.

Questions and answers

Why did on: not become true?

This converter follows YAML 1.2, where only true and false are booleans. In older YAML 1.1 parsers, yes, no, on and off are booleans too, which is why a GitHub Actions on: key can turn into true elsewhere. Here it stays the string "on".

What happens to dates?

They stay strings exactly as written, so 2026-10-22 becomes "2026-10-22". JSON has no date type, and keeping the text avoids time zone surprises.

Does it support anchors, aliases and merge keys?

Yes. &anchors, *aliases and <<: merge keys are expanded, so the JSON contains the full values.

What if the file has several documents?

Documents separated by --- become items of a JSON array, in order. A single document becomes a single JSON value.

Is the YAML uploaded?

No. It is parsed by js-yaml in your browser. Nothing is sent or stored.

Related tools

All JSON & Schema tools

Next step

Need this built into your stack?

The team behind SyntaxSnap builds custom code generators, internal developer tools and API integrations.