Contact

Tools  /  JSON  /  YAML → JSON

YAML → JSON

Parse real YAML (anchors, aliases, flow collections, literal/folded blocks, multi-document, dates) into JSON using js-yaml -- far more than a common-subset parser -- with a strict JSON-schema mode, multi-document array output, and precise line-accurate error reporting.

What this tool does

Paste or load YAML and get back JSON representing the same data, parsed with js-yaml — a real, actively maintained YAML parser — rather than a hand-written parser covering only the common cases.

Why "real YAML" is more than most converters handle

YAML supports a lot more than key-value pairs and lists, and a common-subset parser tends to break, or silently produce the wrong result, on any of it:

  • Anchors, aliases, and the merge key — a block marked with &name can be referenced again with *name, and <<: *name merges it into another mapping, all without repeating the content.
  • Flow collections — inline { }/[ ] syntax mixed into otherwise block-style YAML.
  • Literal and folded block scalars (| and >) — deliberate multi-line text with specific line-break handling.
  • Multi-document streams — a single file containing several YAML documents separated by ---.
  • Typed scalars like dates, parsed as the actual type rather than left as plain text.

Handling more than one document

A YAML stream can hold multiple documents, and the output adapts: a single document converts to one JSON value, multiple documents become a JSON array of them automatically, or the mode can be forced either way regardless of how many documents are actually present.

Checking that YAML is also valid as plain JSON

YAML's default schema allows things JSON has no equivalent for. Switching to the strict JSON schema mode parses using only the types JSON itself supports, which is a real way to confirm a YAML file could be losslessly represented as plain JSON, not just a guess.

Finding exactly where it broke

A parse error reports the precise line it happened on, and clicking the error jumps the cursor straight there — locating a problem in a long configuration file directly instead of scanning it by eye.

Privacy

Parsing and conversion both happen in your browser. Nothing you paste, drop, or load from a file is sent to a server.

Frequently asked questions

Is my data uploaded anywhere?
No. Parsing and conversion both run locally in the browser — nothing is sent to a server.
What does "real YAML" mean here, compared to a common-subset parser?
It means parsing with js-yaml, a genuine spec-compliant implementation, rather than a hand-written parser that only covers plain key-value pairs and lists. Anchors and aliases, the merge key, inline flow collections, literal and folded block scalars, and multi-document streams are all handled correctly rather than breaking or being silently misread.
Can it handle a YAML file containing multiple documents?
Yes — a stream of several documents separated by --- converts to a JSON array of them automatically, and a mode is available to force single-document or always-array output regardless of how many documents are actually present.
What is the strict JSON schema mode for?
It parses using only the types that JSON itself supports, as a real way to check whether a given YAML file could be losslessly represented as plain JSON, rather than just assuming it could.
Does clicking an error jump to the exact broken line?
Yes — a parse error reports the precise line it occurred on, and clicking it moves the cursor straight there instead of requiring a manual search through a long file.
Can it parse YAML anchors, aliases, and the merge key?
Yes — a block marked with an anchor can be referenced again elsewhere with an alias, and the merge key folds an anchored mapping into another one, all resolved correctly rather than left as literal anchor syntax in the output.
Theme Accent