Why some values are quoted
YAML guesses the type of an unquoted value. Older YAML 1.1 parsers — still the default in many tools — read yes, no, on and off as booleans, 0123 as a number, 12:30 as a base-60 number and 2024-01-31 as a date. The classic casualty is the country code for Norway, NO, which turns into false.
When this YAML converter writes YAML it checks every string against those patterns, plus empty strings, leading or trailing spaces, and characters that mean something in YAML (#, : , -, [, &, *, ! and others). Anything that could be misread is single-quoted; text with control characters is double-quoted with escapes. Everything else is left plain, so the output stays readable.
Multi-line strings
A string with line breaks is written as a literal block scalar (|), which keeps every line exactly. The suffix records how the string ended: |- means no final newline, | one, and |+ more than one. If the first line starts with a space an indentation digit is added (|2) so the leading spaces survive.
What the YAML reader accepts
YAML → JSON handles the parts of YAML that configuration files use: nested mappings and lists, lists written at the same indentation as their key, inline [a, b] and {a: 1} collections, plain, single-quoted and double-quoted values (with escapes such as \n and é), literal (|) and folded (>) blocks, comments, a leading --- and a closing ....
Values are typed by the YAML 1.2 core schema: true/false, null/~, integers (including 0x hex and 0o octal) and decimals. Under 1.2, yes and dates stay strings. Anchors (&), aliases (*), merge keys that use them, tags (!!str), explicit ? keys and files with several --- documents are refused with a message naming the line — rather than converted wrongly.