JSON and YAML converter
MDV ToolsPaste JSON or YAML on either side; the other side follows.
How this works
Both directions go through js-yaml 4.1.1 (github.com/nodeca/js-yaml), MIT licensed,
copied into this page with its licence so nothing is fetched. JSON to YAML reads the JSON
with JSON.parse and writes it with js-yaml's dump: block style, the indent
you pick, no line folding, and no anchors, so a value used twice is written out twice. Strings that a
YAML reader could mistake for something else — yes, 0123,
null, text with : in it — are put in quotes. Every JSON number is read as a
64-bit float first, so digits past the 17th are lost before YAML is written.
YAML to JSON reads with the YAML 1.2 core schema plus merge keys
(<<): true, false, null, ~ and
numbers become JSON values; yes, no and on stay strings, as YAML
1.2 says; and a date such as 2026-09-15 stays a string, because JSON has no date type.
Anchors and aliases are written out in full. A file with several documents separated by
--- becomes a JSON array with one item per document, and the page says so. Duplicate
keys, bad indentation and unclosed brackets stop the reading with js-yaml's reason, the line and the
column. Tags JSON cannot hold, such as !!binary or custom tags, are refused by name.
Aliases can make a small file expand enormously; the page stops once the result passes 1,000,000 values and says so, rather than freeze the tab. Each box takes up to 2,000,000 characters. Comments in YAML have no place in JSON and are dropped, and key order follows the input unless Sort keys is on. Nothing is uploaded: there is no server in this file, and neither box is stored.
The Dark button remembers its setting in this browser's local storage. Nothing you type or drop into the page is stored.