In YAML, you can easily create multi-line strings. However, I would like the ability to create a multi-line array (mainly for readibility within config files) using the |
character.
A YAML array can be represented as: ['key1', 'key2', 'key3']
.
A YAML sequence uses a dash followed by a space and then a string:
- String1
- String2
- String3
This would evaluate to: ['string1', 'string2', 'string3']
.
A YAML mapping is an array of key and value pairs that we see all the time in YAML:
Key1: string1
Key2: string2
Key3: string3
This is all well and good, but I can't for the life of me see how to do a multi-line array. Something like this:
|
['string1', 'string2', 'string3']
['string4', 'string5', 'string6']
Short of creating multiple array mappings in YAML and merging them in my programming language of choice, is there any way to achieve multi-line arrays, maybe with { }
like Python has but in YAML?