Glossary

YAML

TL;DR

YAML (YAML Ain’t Markup Language) is a human-readable data serialization format commonly used for configuration files and data exchange between languages with different data structures.


Concept

YAML (YAML Ain’t Markup Language, formerly Yet Another Markup Language) is a human-readable data serialization standard that is commonly used for configuration files, data exchange, and defining structured data. It is designed to be easily readable by humans while being machine-parseable.

Key characteristics of YAML include:

  1. Human-Readable: YAML’s syntax is designed to be intuitive and easy for humans to read and write, using indentation and minimal punctuation.

  2. Hierarchical Structure: YAML naturally represents nested data structures through indentation, making it ideal for configuration files.

  3. Data Types: YAML supports various data types including strings, numbers, booleans, arrays, and associative arrays (dictionaries).

  4. Comments: YAML allows comments using the # symbol, making configuration files self-documenting.

  5. Multi-document Support: A single YAML file can contain multiple documents separated by —.

YAML syntax basics:

  • Key-Value Pairs: key: value
  • Lists:
    - item1
    - item2
    - item3
    
  • Nested Objects: Indentation defines hierarchy
    person:
      name: John
      age: 30
      hobbies:
        - reading
        - coding
    

YAML is commonly used for:

  • Configuration files in applications and infrastructure tools (Docker Compose, Kubernetes, Ansible)
  • Data exchange between applications
  • Defining build specifications and deployment manifests
  • Storing application settings and preferences

Compared to other data formats:

  • JSON: YAML is more human-readable but JSON is more widely supported in web applications
  • XML: YAML is simpler and more concise than XML
  • INI/Properties: YAML can represent more complex nested structures

YAML parsers are available for most programming languages, making it a versatile choice for configuration and data serialization needs.

Related words: XML