Where dropping the quotes changes the value
YAML decides the type of an unquoted value on its own, and that is where the accidents happen.
version: 1.10 is read as a number and becomes 1.1. The trailing zero is gone and the version now means something else. zip: 01234 likewise turns into the number 1234, losing the leading zero. Postcodes, employee numbers and phone numbers all need quoting as "01234".
Values like 12:30, no, yes and on stay as strings in this tool. Older parsers that follow the 1.1 rules — PyYAML and Ruby among them — read no as false instead, which is why the country code NO famously turns into false. If a config passes through several tools, quote those words too.
Indentation rules
Indent with spaces only. A tab is a syntax error. If your editor inserts tabs, switch it to spaces for YAML files.
Items at the same level must line up exactly. One column out and the parse fails right there. This tool reports the line and column it stopped at.
Anchors and merge keys
&name labels a block and *name pastes it in. Adding <<: pours that block into another mapping.
defaults: &d
retry: 2
image: node
job:
<<: *d
script: test
This tool expands merge keys, so the JSON comes out with retry and image inside job. Without expansion you would get a literal "<<" key, which is useless downstream. The syntax turns up constantly in GitLab CI and Docker Compose files.
What is lost on the way to JSON
Comments disappear. JSON has no comment syntax, so converting a config and saving over the original throws away every note anyone left in it. Keep the original.
Multiple documents do not fit either. When a file holds several documents separated by ---, this tool reports an error rather than silently emitting the first one and letting the rest vanish unnoticed. Split a multi-document Kubernetes manifest and convert one piece at a time.
Dates become strings. YAML recognises a date as a type; JSON has no equivalent.
Going the other way
Converting JSON to YAML strips most of the quotes and makes the result easier to read. Quotes stay on strings with leading zeros and on strings that look like true, because removing them there would change the meaning. Leaving them is the correct behaviour, not a formatting glitch.