# Yet Another Markup Language (YAML)
YAML (YAML Ain't Markup Language) is a human-readable data serialization format created by [[Clark Evans]] in 2001, with Ingy döt Net and Oren Ben-Kiki as co-designers. Originally "Yet Another Markup Language," it was later renamed with a recursive acronym to emphasize its data-oriented (not document markup) purpose.
YAML is a superset of [[JavaScript Object Notation (JSON)]]; any valid JSON is also valid YAML. It was designed to be more human-readable than JSON or XML while remaining easy to map to native data structures in most programming languages.
## Key Characteristics
- **Human-readable**: Clean syntax with minimal punctuation
- **Whitespace-sensitive**: Indentation defines structure (like [[Python]])
- **Supports comments**: Unlike JSON
- **Multiple documents**: Single file can contain multiple docs (separated by `---`)
- **Anchors & aliases**: Reuse values with `&` and `*`
## Syntax Examples
```yaml
# Basic types
name: John Doe
age: 30
active: true
salary: null
# Lists
fruits:
- apple
- banana
- orange
# Inline list
colors: [red, green, blue]
# Nested objects
address:
street: 123 Main St
city: Springfield
# Multi-line strings
description: |
This preserves
line breaks
summary: >
This folds
into one line
# Anchors and aliases
defaults: &defaults
timeout: 30
retries: 3
production:
<<: *defaults
timeout: 60
```
## Common Uses
- Configuration files (Docker Compose, Kubernetes, GitHub Actions)
- CI/CD pipelines (`.gitlab-ci.yml`, `.github/workflows/`)
- Infrastructure as Code (Ansible, CloudFormation)
- API specifications (OpenAPI/Swagger)
- Static site generators (Jekyll, Hugo front matter)
## YAML vs JSON
| Aspect | YAML | [[JavaScript Object Notation (JSON)|JSON]] |
|--------|------|------|
| Readability | More human-friendly | More compact |
| Comments | Supported | Not supported |
| Complexity | More features | Simpler spec |
| Parsing | Slower | Faster |
| Use case | Configuration | Data interchange |
## References
- https://yaml.org/
- https://en.wikipedia.org/wiki/YAML
## Related
- [[JavaScript Object Notation (JSON)]]
- [[Clark Evans]]
- [[JSONL]]
- [[Tom's Obvious Minimal Language (TOML)]]