Skip to content

YAML to JSON Converter

Convert YAML to JSON, with YAML 1.2 or 1.1 rules, several documents, anchors and the exact line and column of any error. Runs in your browser.

Runs in your browser

Everything happens on your device: nothing you paste or type is sent to our server or stored. A share link holds your settings, and your input only if you choose to include it.

The two versions read some plain values differently: in 1.1, no is false (the "Norway problem"), 0755 is octal 493 and 1:20 is 80. Pick the version of the program that reads the file: PyYAML (used by Ansible) and many older libraries follow 1.1.

Merge keys (<<: *defaults) copy one mapping into another. They come from YAML 1.1; YAML 1.2 dropped them, but Docker Compose, GitLab CI and most parsers still apply them. Off: << is an ordinary key.

223 characters · 223 bytes (UTF-8) · limit 5 MB

Output: 233 characters.

Documents
1
Input size (bytes)
223
Output size (bytes)
233

Method: YAML 1.2.2 (core schema) → JSON, RFC 8259 · yaml 2.9.1

Off by default. When on, your input is packed into the part of the link after “#”, which browsers never send to any server; anyone you give the link to will see it.

How it works

The YAML is read by the open-source yaml library (version 2.9.1), which follows the YAML 1.2.2 specification and passes the official yaml-test-suite; it loads into your browser the first time you use the converter, and your text is never uploaded. Each document becomes one JSON value, and a file with several documents separated by --- becomes a JSON array with one item per document. A syntax error, a tab used for indentation or a repeated key stops the conversion and shows its line and column.

YAML 1.2 (the default) uses the core schema: only true and false are booleans, numbers are written in decimal, 0o octal or 0x hexadecimal, and everything else is a string. YAML 1.1, still used by many older parsers, also reads yes, no, on, off, y and n as booleans, 0755 as octal and 1:20 as a base-60 number. Merge keys, which copy one mapping into another, are applied by default, as Docker Compose and most parsers do.

Anchors (&name) and aliases (*name) are expanded into full copies. JSON has no tags, dates, binary or non-text keys, so these are converted with a warning: binary becomes Base64 text, YAML 1.1 dates become ISO 8601 text in UTC, keys become text, sets become arrays and .inf or .nan become null. Whole numbers of any length stay exact.

Standards this tool follows

YAML to JSON: Convert Config Files and Catch the Norway Problem

By FindMySum · Last reviewed

This YAML to JSON converter shows exactly how a parser reads your YAML: paste a configuration file, a Kubernetes manifest or a CI pipeline and the JSON appears as you type. It runs in your browser, so secrets that often live in config files stay on your device.

Why convert YAML to JSON

YAML is easy for people to write but easy to misread: indentation carries meaning, quotes are optional, and the same plain word can be a string, a number or a boolean depending on the parser. Converting to JSON makes every type and every level of nesting explicit. It is also the quickest way to feed a YAML file to a tool that only reads JSON, such as a JSON Schema validator or a script using jq.

How to use it

  1. Paste your YAML. Several documents separated by --- are fine.
  2. Leave the version on YAML 1.2 unless the program that reads the file follows the older 1.1 rules (PyYAML, Ruby's Psych and older Go libraries do).
  3. Keep merge keys on if the file uses <<: *defaults, as Docker Compose files often do.
  4. Read the warnings: each one says what JSON couldn't hold and how it was converted.
  5. Copy or download the JSON.

A worked example

countries: [CA, NO, SE]
debug: off
mode: 0644

With YAML 1.2 the result is {"countries": ["CA", "NO", "SE"], "debug": "off", "mode": 644}. Switch to YAML 1.1 and it becomes {"countries": ["CA", false, "SE"], "debug": false, "mode": 420}: Norway's code turned into false, off became a boolean, and 0644 was read as octal (420 in decimal), which is exactly what a file permission means. If both readings must agree, put "NO" and "off" in quotes and write the mode in a form both versions read the same way, such as the decimal 420.

Common mistakes

Tabs for indentation. YAML forbids tabs at the start of a line. Editors that insert a tab produce an error that points to the line; replace it with spaces.

Inconsistent indentation. A key indented one space less than its siblings closes the mapping early, so it ends up at the wrong level. The JSON output makes this visible.

Unquoted special characters. A value starting with @, *, &, !, % or a backtick, or containing : or #, needs quotes. Without them it becomes an alias, a tag or the start of a comment.

Duplicate keys. YAML requires keys in a mapping to be unique, but many parsers silently keep the last one. This converter reports the duplicate instead.

To go the other way, use the JSON to YAML converter; check the JSON on its own with the JSON formatter.

Sources

Frequently Asked Questions

What is the Norway problem?

In YAML 1.1, the plain value no means false, so a list of country codes that includes NO for Norway turns into false. YAML 1.2 fixed this by recognising only true and false, but many tools still follow 1.1 rules. Switch the version setting to see how an older parser reads your file, and quote values like "no" to be safe with both.

Is valid YAML always convertible to JSON?

Nearly always. YAML is a superset of JSON's data model, so the exceptions are features JSON lacks: an alias that refers to a node containing itself (a loop), keys that are lists or maps, and special values such as .inf. Loops are refused with an error; the others are converted with a warning.

Why are my anchors repeated in the JSON?

JSON has no way to point to another part of the document, so each alias is replaced by a full copy of the anchored value. To protect against files built to explode in size (the billion laughs attack), the converter stops after 10,000 alias expansions.

Can I use this to validate a Kubernetes or GitHub Actions file?

It checks that the file is well-formed YAML and shows exactly how a parser reads it, which catches indentation mistakes, tabs and duplicate keys. It doesn't check the file against Kubernetes or GitHub's own rules, such as required fields or allowed values.

Spotted a wrong result or a bug? Report a problem (the link sends the page address only, never what you entered).

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy