What is YAML?
YAML (pronounced “YAML” or “yah-mel”) is a simple, human-readable format for writing data. It lets you list information in a way that looks like plain text, using indentation instead of brackets or tags.
Let's break it down
- YAML: a name that stands for “YAML Ain’t Markup Language,” meaning it’s not meant to be a complex markup like HTML.
- Human-readable: you can read and understand it easily, like reading a list or a recipe.
- Data format: it’s a way to organize pieces of information (numbers, words, lists) so computers can use them.
- Indentation: spaces at the start of a line show how items are grouped together, similar to how outlines work.
Why does it matter?
Because it’s easy for people to write and edit, YAML makes setting up software, sharing configurations, or storing simple data faster and less error-prone. It reduces the learning curve for beginners who need to work with structured information.
Where is it used?
- Configuring applications and services (e.g., Docker Compose files, CI/CD pipelines).
- Defining infrastructure as code (e.g., Ansible playbooks, Kubernetes manifests).
- Storing simple data files for static sites or documentation generators.
- Exchanging data between programs that need a lightweight, readable format.
Good things about it
- Very easy to read and write for humans.
- Supports complex structures (lists, dictionaries, nested data) without extra symbols.
- Works well with many programming languages via built-in or third-party libraries.
- Minimal syntax means fewer typing errors compared to JSON or XML.
- Allows comments, so you can annotate the file directly.
Not-so-good things
- Sensitive to indentation; a misplaced space can break the file.
- No official schema enforcement, so validating data can be harder.
- Can be ambiguous for certain data types (e.g., distinguishing strings from numbers).
- Not ideal for very large datasets where binary formats are more efficient.