YAML Format Specification & Configuration Guide
YAML (YAML Ain't Markup Language) is a human-friendly data serialization standard for all programming languages. It is commonly used for configuration files and in applications where data is being stored or transmitted.
Introduction
YAML targets many of the same communications applications as Extensible Markup Language (XML) but has a minimal syntax which intentionally differs from XML. It uses Python-style indentation to indicate nesting, making it very readable.
Key Features
- Human-Readable: Designed to be easily read by humans.
- Concise: Minimal syntax compared to XML or JSON.
- Expressive: Supports complex data structures like lists, associative arrays, and scalars.
- Portable: Works across different programming languages.
Syntax
YAML uses indentation (spaces, not tabs) to represent structure.
Scalars
Strings, numbers, and booleans are written directly.
name: John Doe
age: 30
isStudent: falseLists (Sequences)
Lists are denoted by a hyphen -.
fruits:
- Apple
- Banana
- OrangeDictionaries (Mappings)
Key-value pairs use a colon :.
address:
street: 123 Main St
city: AnytownExample
invoice: 34843
date : 2001-01-23
bill-to: &id001
given : Chris
family : Dumars
address:
lines: |
458 Walkman Dr.
Suite #292
city : Royal Oak
state : MI
postal : 48046
ship-to: *id001
product:
- sku : BL394D
quantity : 4
description : Basketball
price : 450.00Use Cases
- Configuration Management: Ansible, Kubernetes, Docker Compose all use YAML.
- CI/CD Pipelines: GitHub Actions, GitLab CI use YAML for workflow definitions.
- Data Serialization: Storing data in a readable format.