YAML to JSON

No upload · runs in your browser
Indent
YAML in
0 characters
JSON out

Runs entirely in your browser, nothing is uploaded.

How it works

YAML to JSON Converter with Line-Numbered Errors

Converts YAML to JSON, nested maps, block scalars, flow collections and multi-document files. A parse failure names the line that broke and why.

What this does
  • Nested mappings by indentation, including sequences of mappings and nested sequences
  • Block scalars | and > with strip, clip and keep chomping, plus an explicit indentation digit
  • Multi-document files split on --- and returned as a JSON array, with ... and %YAML directives handled
  • A leading zero keeps its value a string, so 01234 does not silently become 1234
  • Unsupported YAML raises a named error rather than a guess, anchors, merge keys and “? key” syntax all say what they are
FAQ

YAML type inference. Unquoted 1.10 is a float, so it becomes 1.1 and loses the trailing zero; unquoted true, false, null and ~ become JSON literals rather than strings; 0x1f and 0o17 are read as hexadecimal and octal. Two exceptions are deliberate here. A value with a leading zero such as 01234 is kept as a string, because it is almost always a zip code or an account number. And an integer too large to be a JavaScript safe integer is kept as a string as well, rather than being silently rounded. Quote anything that has to survive exactly.

Keep going