Vaultools
Menu

YAML (YAML Ain't Markup Language)

YAML is a human-friendly text format for structured data that uses indentation instead of brackets. It is a superset of JSON and the usual format for configuration files, from Kubernetes manifests and GitHub Actions workflows to Docker Compose and Ansible.

Open the JSON ↔ YAML Converter Runs in your browser

What it looks like

# A Kubernetes-style config
name: web
replicas: 3
ports:
  - 80
  - 443
env:
  DEBUG: "false"
  GREETING: |
    Hello,
    world

Indentation (spaces only, never tabs) shows nesting. key: value lines make a mapping, - item lines make a list, and # starts a comment. Strings usually need no quotes, and | or > start multi-line text. The same data can also be written in JSON-like flow style: ports: [80, 443].

How it relates to JSON

YAML 1.2 is a superset of JSON: every JSON document is valid YAML. YAML adds comments, anchors and aliases (&name and *name) for reusing a block, merge keys (<<) for combining mappings, custom tags such as CloudFormation’s !Ref, and several documents in one file separated by ---. None of those have a JSON equivalent, so converting YAML to JSON drops or expands them, while converting JSON to YAML loses nothing.

Pitfalls

References

Ads on this page

Non-personalized ads help keep Vaultools free — Google decides where they appear on the page.

Go Pro to remove them →