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
&namecan be referenced again with*name, and<<: *namemerges 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.