Search code examples
yamlproperties-filesnakeyaml

Can I assign values to non-leaf nodes in a YAML hierarchy?


Is it possible to create an equivalent YAML-representation of the content of this .properties-file?

foo=Hello
foo.bar=World

I have tried the following:

foo: Hello
  bar: World

But that doesn't appear to cut it as the parser spits out an error:

mapping values are not allowed here


Solution

  • According to the specifications (see section 2.4.1), a node can only be followed by one of: scalar, map, list, or reference. So, no, it cannot have a value assigned to it as well.