JSON to YAML

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

Runs entirely in your browser, nothing is uploaded.

How it works

JSON to YAML Converter : Block Scalars and Safe Quoting

Convert JSON to YAML with real indentation. A value YAML would misread as a boolean or a date gets quoted, so nothing changes type on the way through.

What this does
  • Two-space or four-space nesting, with sequences indented under their key or flush against it
  • A multi-line string becomes a literal block scalar, so its line breaks survive exactly
  • Quotes are added only where a bare value would come back as the wrong type
  • Empty objects and arrays are written inline as {} and [], never as a key with nothing under it
  • Optional A–Z key sort; JSON order is kept otherwise
  • Line count, key count, max depth and encoded size reported with the output
FAQ

Because YAML would otherwise read them as something other than text. To a YAML 1.1 parser the bare word no is the boolean false, the Norway problem, while 1.20 is a number that loses its trailing zero and 2024-01-05 is a date. Anything whose bare form would resolve to a different type gets quoted, and so does a string that opens with an indicator character, ends in a colon, or carries leading or trailing spaces. Single quotes are used unless the value needs an escape only a double-quoted scalar can express.

Keep going