Toolshed

A growing library of browser tools and deep technical guides for IT professionals.

← All guides

YAML Formatter / Validator / JSON Converter

Paste, drag in, or upload a YAML file. Format, minify, validate with a real line/column error, or convert to and from JSON — multi-document files (----separated), anchors/aliases (&name / *name, including merge keys <<), and literal/folded multiline strings (| / >) are all supported. Uses js-yaml (self-hosted, not loaded from a CDN) rather than a hand-rolled parser — YAML's grammar is large enough that a from-scratch parser risks silently mis-reading real-world documents. Only the library's safe default schema is used: it never executes YAML tags or instantiates custom objects. Runs entirely in your browser; nothing you paste or upload is sent anywhere.

What "lossy" means here

YAML can express things JSON can't: comments, anchors/aliases (shared structure — the same object referenced twice), merge keys, and explicit type tags. Converting to JSON has to flatten all of that into plain, independent values, so a warning is shown listing exactly which of those a given document used. Converting a truly circular YAML structure (an alias pointing back to one of its own ancestors) is refused outright with an explanation, rather than attempted — JSON has no way to represent it at all. Documents that would expand to an enormous number of elements once every alias is flattened out (a "billion laughs"-style anchor bomb) are refused the same way, before any attempt to build the output — this is checked separately from the size of what you typed, since a tiny document can still expand to hundreds of millions of nodes through nested aliases.