YAML is a superset of JSON to represent data. So, we can specify objects and arrays in YAML.

Let’s have an object in JSON as follows

{
  "id": 1 ,
  "nae": "Franc"
}

Above can be presented in yaml as

---
id: 1
name: Franc

Suppose you have an array of objects in JSON as

[{
  "id": 1 ,
  "nae": "Franc"
},
{
  "id": 2 ,
  "nae": "John"
}]

equivalent YAML file mapping

---
- id: 1
  nae: Franc
- id: 2
  nae: Joh

Suppose you have a nested array of objects with a string array for one of the properties.

[{
  "id": 1 ,
  "nae": "Franc",
  "roles":["admin","hr"]
},
{
  "id": 2 ,
  "nae": "John",
    "roles":["admin","finance"]

}]

In this object, roles have an array of strings.

YAML nested array of objects

---
- id: 1
  nae: Franc
  roles:
  - admin
  - hr
- id: 2
  name: John
  roles:
  - admin
  - finance

One more example of nested objects array

{"data":
  [{
  "id": 1 ,
  "name": "Franc",
  "roles":["admin","hr"]
},
{
  "id": 2 ,
  "name": "John",
    "roles":["admin","finance"]

}]
}

data property contains a nested array of objects which can be YAML as follows

---
data:
- id: 1
  nae: Franc
  roles:
  - admin
  - hr
- id: 2
  nae: John
  roles:
  - admin
  - finance