Yet another markup language also stands for “YAML Ain’t Markup Language” as the human-friendly cousin of JSON. It’s designed to be easily readable by people while still being perfectly structured for computers to understand.
It is most commonly used for configuration files in tools like Docker, Kubernetes, and GitHub Actions.
- In YAML, spaces are everything. You cannot use tabs; you must use spaces (usually two) to show how data is nested.
- Starts with — (3 dashes) and ends with … (3 periods).
YAML Data Types:
- Key-Value Pairs
This is the bread and butter of YAML. A colon and a space separate the key from the value.
Example
name: “Webserver”
version: 3.0
is_active: true
2. Lists (Arrays)
Lists start with a dash – and a space.
Example
capabilities:
– Text generation
– Image creation
– Video synthesis
3. Dictionaries (Objects)
These are just nested key-value pairs used to group related data.
Example
model_info:
variant: Flash
tier: Free
year: 2026
Advanced Features
1. Comments: Use the # symbol. Anything after it is ignored.
2. Multi-line Strings: * Use | (Literal) to keep line breaks.
3. Use > (Folded) to turn a block of text into a single paragraph.
4. Booleans: You can use true/false, yes/no, or on/off. (Stick to true/false for best practice).
Sample YAML:
—
# A configuration for a hypothetical app
app_settings:
name: MyCoolApp
ports:
– 8080
– 443
environment:
debug: true
secret_key: &key “AX77-99” # An Anchor (shortcut)
description: |
This is a multi-line string
that preserves the breaks.
…
