YAML to JSON Converter

Convert YAML to JSON in your browser. Anchors, merge keys and multi-line text are resolved, large numbers stay exact, and syntax errors point to the line and column with a hint for the usual causes.

YAML input

YAML

JSON output

Paste YAML to see the JSON.

Options

How to convert YAML to JSON

  1. Add your YAML. Paste it, drop a .yaml or .yml file onto the page, or press Load sample.
  2. Check the JSON. Anchors and aliases are resolved and comments are dropped. If the YAML is invalid you get the line, the column and a hint, such as a tab used for indentation.
  3. Copy or download. Pick a 2 or 4 space indent, or minified, then copy the JSON or save it as a .json file.

There is no convert button. The JSON updates whenever the input or an option changes.

Before

name: web
replicas: 3
ports:
  - 80
  - 443
debug: false

After

{
  "name": "web",
  "replicas": 3,
  "ports": [
    80,
    443
  ],
  "debug": false
}

How YAML values become JSON

YAML decides a value's type from how it is written, and JSON needs the type to be explicit. These are the cases that surprise people most. The converter follows the YAML 1.2 core rules.

In the YAMLIn the JSONWhy
replicas: 33A plain whole number is a number.
debug: falsefalsetrue and false are booleans.
owner: null (or ~, or nothing after the colon)nullAll of these mean no value.
enabled: yes"yes"YAML 1.2 treats yes, no, on and off as text. Older YAML 1.1 parsers read them as booleans. Quote them if a tool expects a string.
version: 1.101.1Unquoted, it is a number, and JSON numbers have no trailing zero. Write "1.10" in the YAML to keep it as text.
code: 055A number with a leading zero is read as a number. Quote it, "05", to keep the zero.
date: 2026-03-14"2026-03-14"JSON has no date type, so dates stay as text and are not shifted by a time zone.
mask: 0x1F31Hexadecimal numbers are converted to decimal.
notes: | followed by linesA string with line breaksA block scalar keeps its line breaks. The > style folds lines into spaces.
--- between documentsA JSON arrayA file with several documents becomes an array with one item per document.

Why YAML fails to parse

YAML is strict about whitespace, and its errors are often reported on the line after the real mistake. These are the usual causes.

  • A tab in the indentation. YAML allows only spaces to indent. Replace each tab with spaces.
  • Inconsistent indentation. Items at the same level must start in the same column. One extra space makes a key look like it belongs to the line above.
  • A missing space after the colon. key:value is one text value, not a key and a value. Write key: value.
  • A colon or a # inside text. A : in an unquoted string starts a new key, and a # after a space starts a comment. Put the text in quotes.
  • A key written twice. A mapping can use each key only once.
  • An alias with no anchor. *name needs a &name defined earlier in the file.

What this converter does

Private by design
The YAML is parsed in your browser tab and is never uploaded. That makes it safe for files that contain hostnames, tokens used in examples or internal paths.
Large numbers stay exact
A whole number such as 12345678901234567890 is written to the JSON with every digit. Decimal numbers are written the way JavaScript prints them, so 4.50 becomes 4.5.
Anchors and merge keys are resolved
An alias is replaced by a copy of the anchored value, and a merge key (<<) is merged into its parent, so the JSON is self-contained.
No code is run
Custom tags such as !!python/object are not supported and are reported as an error. The converter only reads data.
Open-source parser
Parsing uses the js-yaml library (MIT licence), which is served from this site. The conversion rules above are the parts of the YAML 1.2 specification it follows.
Related tools
To go the other way, use JSON to YAML. To check the result against a structure, try the JSON Schema validator, or tidy it in the JSON Formatter.

When you need YAML as JSON

YAML is common in configuration: Kubernetes manifests, GitHub Actions workflows, docker-compose files, OpenAPI specifications and Ansible variables. Many tools that read or check that data accept only JSON, including schema validators, command-line tools that take JSON input and web APIs. Converting is also a quick way to see what a YAML file really contains once indentation, anchors and merge keys are applied.

Frequently asked questions

How do I convert YAML to JSON?

Paste the YAML into the input box or drop a .yaml or .yml file on the page. The JSON appears straight away. Choose the indent you want, then press Copy or Download .json.

Are YAML comments kept?

No. JSON has no comments, so they are dropped. If you convert back to YAML you will need to add comments again by hand.

What happens to anchors, aliases and merge keys?

They are resolved. An alias is replaced by a copy of the value it points to, and a merge key is merged into the mapping that contains it, so the JSON has no references left.

Why did yes and no stay as text instead of true and false?

This converter follows YAML 1.2, which only treats true and false as booleans. Older YAML 1.1 parsers also read yes, no, on and off as booleans. If another tool expects a boolean, write true or false in the YAML.

Why does version 1.10 become 1.1?

An unquoted 1.10 is a number, and JSON writes the number as 1.1. Put the value in quotes in the YAML, "1.10", and it stays text with the trailing zero.

What happens to a file with several documents?

A YAML file can hold several documents separated by three dashes. They are converted to a JSON array with one item per document.

Is my YAML uploaded to a server?

No. The conversion runs in your browser and nothing is sent anywhere.

What does the tab error mean?

YAML does not allow tab characters for indentation. Replace the tabs at the start of the lines with spaces, usually two per level, and the error goes away.

Does it support custom YAML tags?

No. Tags that ask the parser to build objects, such as !!python/object, are rejected with an error. Standard data such as text, numbers, booleans, null, lists and mappings is supported.