YAML

YAML Yet Another Markup Language YAML Ain't Markup Language

Glossary

YAML (recursively “YAML Ain’t Markup Language”, originally “Yet Another Markup Language”) is a human-readable data description language used above all for configuration files and data structuring. YAML uses a simple, indentation-based syntax to represent complex data in an easily readable and writable form and is frequently used for configuration files, APIs and data transfer.

YAML syntax at a glance

name: aceArt GmbH
founded: 2015
services:
  - Web development
  - App development
  - SEO
contact:
  city: Stuttgart
  active: true

Structure arises exclusively through indentation with spaces – tabs are not allowed per the specification, since they’re rendered at different widths depending on the editor and would make the structure ambiguous. Lists are represented with a hyphen, nested objects through additional indentation levels.

YAML vs. JSON

Both formats represent the same data structures but differ clearly in their aims:

YAMLJSON
Readability for humansHigh, through indentation instead of bracketsLower, compact and bracket-heavy
CommentsSupported (# comment)Not supported
Structure errorsHarder to spot (invisible indentation errors)Easier to spot (a missing bracket is visible)
Typical useConfiguration filesAPIs, data exchange between systems

Since JSON is a subset of YAML, every valid JSON document is automatically valid YAML too.

Common pitfalls

  • Tabs instead of spaces: leads to parser errors, since YAML permits only spaces for indentation.
  • Unquoted ambiguous values: words like yes, no, on or off are automatically interpreted as booleans by some YAML parsers – problematic with country codes like NO, say. When in doubt, always quote.
  • Inconsistent indentation depth: unlike curly braces in JSON, a single wrong space in YAML silently changes the document structure without producing an obvious error.

A solid understanding of the underlying syntax helps catch such errors early instead of only noticing them at execution time.

YAML in CI/CD and container infrastructure

YAML is today practically the standard for configuration files in modern development workflows: CI/CD pipelines define build and deployment steps in YAML, Docker Compose files describe container setups, and Kubernetes uses YAML as the primary format for practically every resource definition. Its good human readability makes YAML particularly suited to files regularly maintained by hand and read in code review.

Conclusion

YAML has established itself as the standard for readable, maintainable configuration files, from simple application settings to complex CI/CD and Kubernetes infrastructures. We’re happy to support you with setting up and maintaining the corresponding deployment and infrastructure configuration as part of our custom software development or directly in a no-obligation consultation.

Häufige Fragen

Is YAML the same as JSON?
Not quite, even though both can represent the same data structures (lists, objects, scalar values). YAML is optimised for human readability and uses indentation instead of brackets; JSON is more compact and optimised for machine processing. Practically: every valid JSON document is also valid YAML, since YAML is a superset of JSON.
Why can't you use tabs for indentation in YAML?
Because the YAML specification explicitly forbids tabs for indentation – only spaces are allowed. The reason is unambiguity: tabs are rendered at different widths by different editors and terminals, which would make a document’s structure interpretable differently depending on the display.
Why are some values in YAML interpreted unexpectedly, e.g. "no" as false?
Older YAML versions automatically interpret certain unquoted words like yes, no, on or off as boolean values instead of text – a notorious problem that in practice leads to errors with country codes like NO (Norway), say. To avoid this, such ambiguous values should always be explicitly quoted.
What is YAML most frequently used for in practice?
Above all for configuration files: CI/CD pipelines (GitHub Actions or GitLab CI, say), container orchestration with Kubernetes, Docker Compose files and infrastructure-as-code tools. Its good human readability makes YAML particularly suited to files regularly read and manually edited by people.
Can you mix YAML and JSON?
Yes, even within the same file – since JSON is a subset of YAML, JSON syntax elements like { } and [ ] can be used directly in YAML documents. In practice this is rarely done, but it’s technically unproblematic and sometimes practical for compact, single-line lists.
What makes YAML harder to debug than JSON?
Above all the significance of indentation: a single misplaced space can change the entire document structure without producing an immediately obvious syntax error. JSON, in contrast, makes structure visible through explicit brackets, making errors easier to find when debugging – in return, JSON is overall less pleasant for people to read and write.
← Back to glossary
HOMEGLOSSARYYAML