YAML to JSON Converter

Convert YAML config files into clean, formatted JSON. Errors are shown with the exact line.

YAML Input

Ln 1, Col 1Empty

JSON Result

Your result will appear here.
No result yet

What Is a YAML to JSON Converter?

A YAML to JSON converter reads YAML, the format used by most config files, and writes the same data as JSON. This is useful when an API, a script or a tool only accepts JSON, or when you want to check what your YAML really contains.

How to Convert YAML to JSON

  1. Paste your YAML into the YAML Input box, click Upload, or drop a .yaml file.
  2. Click Convert to JSON, or press Ctrl + Enter.
  3. If there is an error, the broken line is marked in red with the line and column.
  4. Click Copy or Download to save the JSON.

Features

  • Supports nested maps, lists, comments, multi-line text and anchors.
  • Several documents separated by --- become a JSON array.
  • Clear error messages with line and column.
  • Choose 2 spaces, 4 spaces or minified JSON.
  • Runs in your browser. Your YAML is never uploaded.

Anchors and Merge Keys

YAML can reuse a block with an anchor (&) and pull it in with a merge key (<<: *). JSON has no such feature, so the converter writes the values out in full:

YAML
base: &base
  timeout: 30
  retries: 3
prod:
  <<: *base
  retries: 5
JSON
{
  "base": { "timeout": 30, "retries": 3 },
  "prod": { "timeout": 30, "retries": 5 }
}

Comments are dropped too, because JSON does not allow them.

Watch Out for Numbers

Unquoted values become numbers when they look like numbers. That means version: 1.10 becomes 1.1 and zip: 01234 becomes 1234 in the JSON. If a value must stay text, put it in quotes in the YAML: version: "1.10".

Common YAML Errors

  • bad indentation of a mapping entry: one line has a different number of spaces than its neighbours.
  • Tabs: YAML only allows spaces for indentation.
  • Missing space after a colon: write key: value, not key:value.
  • Unquoted special characters: values starting with @, *, & or containing : need quotes.

The error message shows the line and column, so you can jump straight to the problem. To go the other way, use JSON to YAML. Have a TOML config such as Cargo.toml or pyproject.toml? Use TOML to JSON.

Frequently Asked Questions

Is this YAML to JSON converter free?

Yes. It is free, with no sign-up and no limits.

Can it read files with several YAML documents?

Yes. If your YAML has more than one document separated by ---, the result is a JSON array with one item per document.

What if my YAML has an error?

The tool shows the line and column of the problem and highlights that line in red, so you can fix it quickly.

Is my YAML uploaded anywhere?

No. Everything runs in your browser. Your YAML never leaves your device.

Related Tools