YAML
YAML
A human-friendly configuration format that expresses structure through indentation
Introduction
YAML (YAML Ain't Markup Language) is a data format that expresses hierarchy through indentation, making it easy for humans to read and write. As a superset of JSON, it can hold the same data more concisely, so it is widely used for configuration files.
It has become the configuration standard for DevOps tools such as Docker Compose, Kubernetes, and CI pipelines.
Syntax Features
- Hierarchy is expressed with indentation (spaces), and tab characters cannot be used.
- List items use a hyphen (-), and mappings use a colon (:).
- Comments are written with the # symbol.
- Strings can be written without quotes, but quotes are required when they contain special characters.
Pros
- Easy for humans to read and write
- Supports comments
- Well suited to configuration files
Cons
- Sensitive to indentation mistakes
- A complex specification with many edge cases
- Tabs and spaces are easily confused
Common Uses
- Docker Compose and Kubernetes manifests
- CI/CD pipeline configuration
- Application configuration files
Example
- id: 1
name: Ada
role: admin
- id: 2
name: Linus
role: editor