LazyTools

🔒 Every tool runs in your browser, the files and values you enter are never uploaded to any server. How it works

🧾 YAML to JSON Converter

Paste YAML, a Kubernetes manifest, CI config, front-matter, and get exact JSON, with YAML errors explained.

valid YAML ✓

Rate this tool:
Anonymous, no account, no identifier

How the yaml to json converter works

Parsing uses js-yaml, a full YAML implementation, indentation rules, anchors and aliases, multi-line strings and type tags all behave to spec, and syntax errors report the offending line. The parsed structure is then emitted as standard JSON (pretty-printed or minified). During parsing, indentation determines nesting depth, "- " items become array elements, and unquoted scalars are typed by YAML's rules, so 3 becomes a number, true a boolean, and an empty value null. Comments (# …) exist only in YAML and are discarded, which is the single unavoidable loss in this direction.

One YAML behavior worth knowing: unquoted values like yes, no, on and off parse as booleans under YAML 1.1 conventions, the famous "Norway problem," where the country code NO becomes false. If a value must stay a string, quote it in the YAML source.

Frequently asked questions

Why did my value "no" become false?

YAML 1.1 treats yes/no/on/off as booleans, the "Norway problem." Quote the value in the source ("no") to keep it a string; the converter faithfully reflects what the YAML spec says your document means.

Are anchors and aliases supported?

Yes, &anchor definitions and *alias references resolve during parsing, so the JSON contains the expanded values.

What about comments?

YAML comments have no JSON equivalent and are dropped, the one inherently lossy part of this direction.

Why does my YAML fail with an indentation error?

YAML forbids tabs for indentation and requires consistent spaces. The error message names the line; converting tabs to spaces fixes the majority of cases.

How does a multi-document YAML file convert?

A file with several documents separated by --- holds more than one root value. Standard JSON is a single document, so convert one section at a time, or expect only the first document to map directly, JSON has no separator to represent the boundary.

Does a leading document marker cause problems?

No, a lone --- at the top (an explicit document start) is understood by the parser and does not appear in the JSON. It only matters when several --- markers split multiple documents in one file.

Is my file uploaded?

No, parsing is local and offline-capable; manifests and configs stay on your machine.

Related file converters

From the blog