YAML to JSON Converter and Validator

Convert and validate YAML and JSON, and see where YAML 1.1 and 1.2 disagree about a value.

Runs in your browser. Your input is not sent anywhere.

Paste the text to convert. It is also checked for errors.

1.2 is the current standard; many tools, such as PyYAML, still follow 1.1.

Off by default. When on, the fields of this tool are kept in the local storage of this browser, unencrypted, until you turn it off.

Nothing to convert yet

Your result will appear here.

Keyboard shortcuts

Ctrl + Enter, ⌘ + Enter
Run the tool with the current input
Alt + Shift + C
Copy the result
Alt + Shift + X
Clear all fields

Shortcuts work while the focus is inside the tool. Every action is also available as a button.

How to use it

  1. Paste YAML, or choose “JSON to YAML” and paste JSON.
  2. Choose the YAML version of the program that reads or wrote the file: 1.2 for current parsers, 1.1 for PyYAML and other older ones.
  3. Read the result. An error names the line and column and selects the spot in the field.
  4. Read the warnings: they list every value that the other YAML version would read differently, and what was changed to fit JSON.
  5. Copy or download the result.

Worked example: one file, two readings

The same four lines give different data depending on the YAML version:

YAML input
country: NO
mode: 0755
duration: 1:30
version: 3.10
JSON with YAML 1.2 and with YAML 1.1
YAML 1.2: {"country": "NO", "mode": 755, "duration": "1:30", "version": 3.1}
YAML 1.1: {"country": false, "mode": 493, "duration": 90, "version": 3.1}

In YAML 1.1 the word NO is a boolean (the “Norway problem”), 0755 is an octal number (493) and 1:30 is a base-60 number (90). YAML 1.2 reads the first and third as strings and 0755 as the decimal number 755; octal is written 0o755 there. Both versions read 3.10 as the number 3.1, so a version string needs quotes. The tool lists the first three as warnings, whichever version you choose.

How the conversion works

The tool uses the open-source yaml library (eemeli/yaml), which implements both the YAML 1.2 core schema and the YAML 1.1 types. It is loaded the first time you convert. The text is parsed twice, once for each version, and every unquoted value is compared; where the two readings differ, the tool shows both.

YAML can express things that JSON cannot. Keys that are not strings, such as 1 or true, become strings. Anchors and aliases (&name and *name) are expanded into copies, with a limit of 100 aliases against “billion laughs” files. Several documents separated by --- become a JSON array. Dates of YAML 1.1 become ISO 8601 strings, .inf and .nan become null, and integers keep every digit, even beyond the 2^53 limit of JavaScript numbers.

In the other direction the JSON is checked strictly first. The YAML output uses block style, keeps the numbers as written and puts quotes around every string that a YAML 1.1 or 1.2 reader would otherwise take for something else, such as "no", "0755" or "2001-12-14", so the file reads back as the same data in both versions. A key named << is quoted too, because YAML 1.1 would read it as a merge key.

YAML 1.1 and YAML 1.2 at a glance

Unquoted values that the versions read differently
ValueYAML 1.1YAML 1.2 (core schema)
yes, no, on, off, y, ntrue or falseThe string itself
0755493 (octal)755 (decimal)
0o755The string “0o755”493 (octal)
1:3090 (base 60)The string “1:30”
2001-12-14A dateThe string “2001-12-14”
<<Merge keyAn ordinary key

The YAML 1.1 type definitions list y and n as booleans, but PyYAML, a widely used YAML 1.1 parser, reads them as strings. This tool’s 1.1 mode follows the type definitions, so its results for y and n differ from PyYAML. Quote such values and nothing depends on the parser.

The same on the command line

Converting with yq or Python
# yq (mikefarah/yq, v4)
yq -o=json config.yaml
yq -p=json -o=yaml config.json

# Python with PyYAML (YAML 1.1 rules)
python3 -c "import sys, json, yaml; print(json.dumps(yaml.safe_load(sys.stdin), indent=2, default=str))" < config.yaml

Common mistakes

  • Leaving country codes, answers or switches unquoted: NO, yes and off turn into booleans for YAML 1.1 parsers.
  • Writing file modes or ZIP codes with a leading zero, such as 0755 or 01234, without quotes.
  • Writing version numbers such as 3.10 or 1.20 without quotes; they become 3.1 and 1.2.
  • Indenting with tabs. YAML allows only spaces for indentation.
  • Repeating a key in the same mapping. Some parsers keep the last value silently; this tool reports it as an error.

Sources

Frequently asked questions

Why did my NO or yes become false or true?
Your YAML is being read with YAML 1.1 rules, where yes, no, on and off are booleans. YAML 1.2 treats them as strings, but many programs still use 1.1 parsers. Put the value in quotes, such as "NO", and every parser keeps it as text.
Is YAML a superset of JSON?
YAML 1.2 was designed so that valid JSON is also valid YAML, with small exceptions such as duplicate keys, which JSON allows and YAML forbids. That is why this tool reads JSON strictly first and reports duplicate keys as errors.
How do I validate a YAML file?
Paste it with “YAML to JSON” selected. If it converts, it is well-formed YAML; an error names the line and column. Validity against a schema, such as a Kubernetes manifest or an OpenAPI file, is a separate check that needs that schema.
Are comments kept?
No. JSON has no comments, so they are lost when converting YAML to JSON, and JSON has none to carry over the other way.
Is my data uploaded?
No. The text is parsed and converted in your browser; only the converter code itself is loaded from this site the first time you use it. If this page shows ads, the ad script runs in the same page, but the tool never passes your input to it.

Last updated: September 29, 2026