YAML Multi-Line Arrays

A YAML sequence is an array. So this is the right way to express it:

  - string1
  - string2      
  - string3
  - string4
  - string5
  - string6

That’s identical in meaning to:

key: ['string1', 'string2', 'string3', 'string4', 'string5', 'string6']

It’s also legal to split a single-line array over several lines:

key: ['string1', 'string2', 'string3', 
  'string4', 'string5', 

and even have multi-line strings in single-line arrays:

key: ['string1', 'long
  string', 'string3', 'string4', 'string5', 'string6']

Leave a Comment