Arrays are group of fixed size elements. Array elements are configured in YAML file as each line as an separate line i.e multi line array strings

In YAML, arrays are declared with following syntax

let’s declare an array in any programming languages


The same can be resented with yaml sequence

- admin
- finance
- hr

Let’s declare key and value in YAML with value is an array

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

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

Here is an example for YAML sequence which is equivalent to multiline 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 multi line strings

Suppose you have a list of employee object in json which contain array of arrys

  "employees": [

YAML represent array of arrays as follows

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