5

Is it possible to have multi-line yaml as the key?

Here's my current multi-line yaml:

|
line one
line two

But this doesn't seem to work for when I make the above a key, like:

|
line one
line two:
  value

I've reviewed In YAML, how do I break a string over multiple lines? but I don't think it addresses exactly what I want to do. Does anyone know of a good solution for this?

Community
  • 1
  • 1
d3ming
  • 8,496
  • 5
  • 31
  • 33

1 Answers1

6

Multiline strings are "complex" yaml objects, so to use them as keys in a map, you need to use the ?key: format:

? |
  line one
  line two
: value
Chris Dodd
  • 119,907
  • 13
  • 134
  • 226