What is YAML?
YAML Ain’t Markup Language (YAML) is often called a data serialization language. It was intended to be human-readable and organize data into a structured format. Programming languages can understand the content of YAML files (which usually have a .yml
or.yaml
extension) and map them to built-in data types. For example, when you consume a .yaml
file in yourPythonscript, it will automatically convert the content into either a dictionary {}
or list []
, so you can work and iterate over it.
YAML rules help to construct a readable file so it's important to understand them in order to write a valid and well formatted YAML file.
YAML file formatting
There're a few rules to follow while developing YAML files. YAML uses indentation (like Python), which builds the relationship of items with one another:
- So, the first rule when writing a YAML file is to make your indentation consistent, using either whitespace or tabs, and don't mix them.
- The second rule is to use a colon
:
when creating a dictionary...