YAML to JSON Converter

Parse YAML, report syntax errors precisely, and output the equivalent JSON.

Loading tool…

About the YAML to JSON

The YAML is parsed with js-yaml using the YAML 1.2 core schema. Anchors (&base) and aliases (*base) are resolved, and merge keys (<<: *base) are expanded, so the JSON shows the data an application actually receives. Comments are discarded because JSON cannot hold them.

Invalid YAML produces an error with the line and column, e.g. a tab used for indentation or a key indented at the wrong level. That makes this a quick validator for docker-compose.yml, Helm values or a CI workflow before you commit.

Type resolution follows YAML 1.2: true/false are booleans, but yes, no and on stay strings. Timestamps such as 2024-01-15 are written as ISO strings. Only the first document of a multi-document stream (separated by ---) is converted. Parsing runs in your browser.

Example: replicas: 3 becomes "replicas": 3 and version: 2.4.1 becomes the string "2.4.1" because it is not a valid number.

How to use it

  1. Paste YAML or open a .yaml/.yml file.
  2. Fix any error reported with its line number.
  3. Choose indentation and copy or download the JSON.

Frequently asked questions

Why does “yes” stay a string?
YAML 1.2 only treats true and false as booleans. YAML 1.1 parsers (like older PyYAML) also accepted yes/no/on/off.
How are anchors and aliases converted?
They are resolved: each alias is replaced by a copy of the anchored value in the JSON output.
What does “bad indentation” mean?
A line is indented to a level that does not match its parent. YAML uses spaces only; check for tabs or an extra space.

Related tools