YAML is a superset of JSON
The basic structure of YAML is a hash map -
key: value
key: >
Lorem ipsum so you
can tripsum dipsum
this YAML below
scalar:
- never
- gonna
- give
- you
- up
is equivalent to this JSON (see this to translate YAML to JSON)
{
"scalar": [
"never",
"gonna",
"give",
"you",
"up"
]
}
Items in sequesnce can can also be key value pairs
key:
- stuff: "things"
- other_stuff:
key: "value"
Anchors are identified by an & and alises by *
Anchors essentially are the process of setting a variable and alises are the process of using it
so &name Eric
will set the name to Eric and later can be accesses as *name
To save references to alias use >>
default: &default
school: hogwarts
harry:
<<: *default
house: gryffindor
draco:
<<: *default
house: slytherin
name: &harry_name
first_name: Harry
last_name: Potter
address: &harry_address
street: 4, Privet Drive
district: Little Whinging
county: Surrey
country: England
harry_data:
<<: [*harry_name, *harry_address]
Note: Its is possible to merge maps, but not sequences