4

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
  • 7,690
  • 5
  • 29
  • 33

1 Answers1

5

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
  • 111,130
  • 12
  • 123
  • 212