Formatting
YAML formatter parses the document and prints it again, which normalizes indentation and quoting without changing the values. color: red and count: 2 come back as color: red and count: 2, a two-key mapping. A list that was written with uneven spaces is reprinted in the library’s usual style. The page is doing a parse, so a tab in the wrong place or a broken indent fails with the parser’s message instead of a half-formatted file.
Anchors and aliases are allowed up to a limit of 100 expansions, which stops a malicious alias loop from hanging the tab. The reprint is one document’s text. This page does not convert to JSON. The YAML and JSON page does that, in both directions, and its to-json result for the same mapping is an object with color and count.
A plain sentence such as Odd socks in the dryer. is valid YAML: it is a single string, and the reprint is that string. If you meant a mapping, the sentence is the wrong shape, not a broken parser.
color: red\ncount: 2
color: red\ncount: 2
Reprinting from the parse tree drops insignificant indent differences and still fails closed on YAML the parser will not accept.
A plain scalar is valid YAML. Odd socks in the dryer. reprints as that string. It is not a mapping, and it is not an error.
Alias expansion is capped at 100. A document built to explode aliases fails instead of running away.
No. The YAML and JSON page converts. to-json of color and count is { "color": "red", "count": 2 }.
The reprint comes from the parsed value. Comments are not part of the data model, so do not expect them to survive a format pass.