During learning Kubernetes from Udemy class, I learned about syntax of YAML language. I’ve seen YAML file before but I never really looked into their syntax for data structure and this was very helpful.
List
We can write a list of items in YAML by using a -
(a dash and a space).
Fruits:
- Apple
- Orange
- Banana
- Blueberry
Dictionary
We can have a dictionary of key and value in YAML by using a colon and spaces.
John:
Name: John Doe
Job: Software Developer
List of Dictionary
It is possible to have a list of dictionary in YAML syntax.
Fruits:
- Apple:
Color: Red
- Orange:
Color: Orange
- Banana:
Color: Yellow
- Blueberry:
Color: Blue