YAML, is a data serialization language commonly used in writing configuration files, and works for all programming languages. The YAML bit officially is an acronym for YAML ain't markup language. Recursion is not how this superset of JSON started its life though. According to the YAML 1.0 working draft, it was just Yet Another Markup Language.
Why are we talking about YAML?
YAML has been gaining popularity steadily since it was launched circa 2001. It is used for log files, caching, messaging, or object persistence, and, as we mentioned earlier, for all programming languages.
YAML use cases include:
- Powering container orchestration infrastructure via Helm Charts.
- Creating automation processes. Check out Ansible Playbook.
- Configuring developer environments like Google Flutter, the portable UI and toolkit for cross-platform app development.
In all of these, a YAML script works by listing out relevant resources at hand for the app or system. Then, YAML explains how they should interact with each another.
YAML's human-readable syntax
One thing contributing to YAML's popularity is that even though it is immensely powerful, it's super human-readable. You can quickly whip up a .yaml script using the text editor. The syntax is easy to pick up as well.
To see this in action, take this example of a simple YAML file from Red Hat:
--- # An employee record name: Martin D'vloper job: Developer skill: Elite employed: True foods: - Apple - Orange - Strawberry - Mango languages: perl: Elite python: Elite pascal: Lame education: | 4 GCSEs 3 A-Levels BSc in the Internet of Things
However, there is a flip side to this human-readability: YAML's spacing system can be a frequent pain point. YAML scripts require a precise number of spaces across multiple lines to show where data sits in a hierarchy, making them very easy to break.