YAML

What is YAML?

YAML file is used to represent data (in this case configuration data).

Basic YAML file data will be in the format of key: value pairs.
A space should be followed by : inorder to differentiate the key and the value.

key value pair
Fruit: Apple
Vegetable: Carrot

Array/Lists
Fruits:
- Orange
- Apple
- Banana

Vegetables:
- Carrot
- Cauliflower
- Tomato

- indicates that it is an element of the array.

Dictionary/Map
Banana:
    Calories: 105
    Fat: 0.4 g
    Carbs: 27 g

Grapes:
    Calories: 62
    Fat: 0.3 g
    Carbs: 16 g

We must have equal number of blank spaces before the properties of a single item, so they are all aligned together.

'#' indicates comment line in YAML file

Dictionaries vs Lists

Dictionaries are unordered collections (order of items does not matter). Lists are ordered collections (order of items matter).