YAML: Keys like "yes" or "no" evaluate to true and false

If you parse this Yaml ...

yes: 'Totally'
no: 'Nope'

... you get this Ruby hash:

{ true: 'Totally',
  false: 'Nope' }

In order to use the strings 'yes' and 'no' as keys, you need to wrap them with quotes:

'yes': 'Totally'
'no': 'Nope'

There's actually a long list of reserved words Archive with this behavior:


I'm sorry.

Henning Koch about 8 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more