The content of a mapping node is an unordered set of key/value node pairs, with the restriction that each of the keys is unique. YAML places no further restrictions on the nodes.
2. Lists/Arrays:
The content of a list node is an ordered series of zero or more nodes. In particular, a sequence may contain the same node more than once. It could even contain itself.
3. Literals (Strings, numbers, boolean, etc.):
The content of a scalar node is an opaque datum that can be presented as a series of zero or more Unicode characters.
Let us try and identify where these appear in the sample YAML file we saw earlier.
settings: # Value is a Dictionary with keys `cache` and `cache_expiration`
cache: true # Value is a Boolean Literal
cache_expiration: 60 # Value is a Number Literal
asset_directory: # Value is a List with two Items
- config/movie assets # List Item is a String Literal
- config/tv assets # List Item is a String Literal
```
## Indentation
A YAML file relies on whitespace and indentation to indicate nesting. The number of spaces used for indentation doesn’t matter as long as they are consistent.
**It is critical to note that tab characters cannot be used for indentation in YAML files; only spaces can be used.**
Dictionaries are used to associate key/value pairs that are unordered. Dictionaries can be nested by increasing the indentation, or new dictionaries can be created at the same level by resolving the previous one.
```yaml
cache: true
cache_expiration: 60
```
The "keys" are `cache` and `cache_expiration` and the "values" are `true` and `60` respectively.
### In-Line Dictionaries
you can represent a dictionary on a single line by using `{` and `}`
The string literals do not require to be quoted. It is only important to quote them when they contain a value that can be mistaken as a special character.
Here is an example where the string has to be quoted as `&` and `:` are special characters.
There are many occurrences of these special characters where quotes are not needed but if the YAML fails to load it could easily be because one of these are unquoted.
```yaml
message1: YAML & JSON # breaks as a & is a special character
message2: "YAML & JSON" # Works as the string is quoted
With a lot of configuration, configuration files can become quite large.
In YAML files, anchors (`&`) and aliases (`*`) are used to avoid duplication. When writing large configurations in YAML, it is common for a specific configuration to be repeated. For example, the vars config is repeated for all three services in the following YAML snippet.