YAML 1.1 vs 1.2

Direct answer

YAML 1.1 treats yes/no/on/off (and sometimes NO) as booleans; YAML 1.2 core/JSON schema does not. Quote ambiguous scalars and prefer true/false for booleans so configs behave the same in PyYAML, Go, and js-yaml.

When this matters

Parsers disagree on YAML 1.1 vs 1.2. Values like yes, no, on, off, and leading-zero numbers can become booleans or octals in 1.1 but strings/decimals in 1.2. Quote ambiguous scalars when you mean text.

Boolean interpretation

ValueYAML 1.1YAML 1.2 (JSON schema)
true / falsebooleanboolean
yes / nobooleanstring
on / offbooleanstring
Norway country code pitfall NOmay become falsestring NO

Safer pattern

country: "NO"
enabled: true
legacy_flag: "yes"

Quote country codes and yes/no when they must remain strings across parsers.

References

Library notes

  • PyYAML historically follows YAML 1.1-style truthy values unless configured otherwise.
  • js-yaml defaults are closer to YAML 1.2 JSON schema for many scalars.
  • Always test the same file in the runtime that will load it in production.