superpuper
superpuper

Reputation: 37

How work with collections in YAML

I have

init:
   test: yasha,grisha
      my: ${init.test[0]}

And it's now working. How work with list/arrays in YAML?

Upvotes: 1

Views: 5641

Answers (1)

Anthon
Anthon

Reputation: 76598

A list in YAML (normally called a sequence) can be specified in in block style:

a:
- 1
- 2

and flow style:

a: [1, 2]

both depicting a mapping with one key a, for which the value is the sequence/list consisting of elements 1 and 2

The dashes before the elements in block style can, but do not have to be, indented further than the "parent" element

Upvotes: 3

Related Questions