Skip to content
uencoder

YAML

YAML (YAML Ain't Markup Language) is a configuration-oriented data serialization format using indentation for hierarchy, supporting comments and references, and better suited to hand editing than JSON.

Purpose

To provide a configuration format easier to write and maintain by hand than JSON, supporting comments, multiple documents, and anchor references.

Mechanism

Indentation (spaces, never tabs) expresses nesting, colons separate keys from values, and dashes mark list items. It supports comments (#), multiple documents (---), and anchors (&) with aliases (*) for reference. Watch out for type inference (yes/no becoming booleans).

Use cases

  • CI/CD configuration (GitHub Actions, GitLab CI)
  • Kubernetes manifests
  • Docker Compose
  • Application configuration files

Examples

  • Input
    name: Ada
    age: 36
    Output
    The object {name:"Ada", age:36}

    Indentation expresses hierarchy

Common errors

Indenting with tabs (YAML allows spaces only)
Use spaces for indentation consistently

Related terms

Related tools

Related tutorials

References