Arrays are a group of fixed-size elements. Array elements in the YAML file contain separate lines, Also called multiline array strings.

In YAML, arrays syntax is

let’s declare an array in any programming languages


Above written with yaml sequence also

- admin
- finance
- hr

Let’s declare key and value as an array in YAML.

roles contain an array of admin, hr and sales, finance

We have to use a sequence with key=roles, and value is a multi-line array of strings.

Here is an example of the YAML sequence that is the same as multi-line strings.

- admin
- finance
- hr
- sales

Also this can be represented as in multiple ways


This is good as it is very easy to read and understand. or


Array of arrays in yaml in multiline strings

Suppose you have a list of employee objects in json which contain an array of arrays.

  "employees": [

YAML represent an array of arrays as follows

- - emp1
  - emp2
  - emp3
- - emp11
  - emp12
  - emp13