YAML (YAML Ain't Markup Language)
What is YAML (YAML Ain't Markup Language)?
YAML (YAML Ain't Markup Language) is a data serialization language used as the input format for diverse software applications.
An application user or administrator specifies data in a YAML file that the application then reads. For example, YAML files can define users or install software packages on servers.
The YAML acronym originally stood for "Yet Another Markup Language" when YAML debuted in May 2001. By the start of 2002, the language's creators had changed the acronym's meaning to the recursive "YAML Ain't Markup Language" to reflect that, while YAML's structure resembles a markup language, it is not used for document markup.
Applications that use YAML include the configuration management tool Ansible, the container orchestrator Kubernetes and the orchestration engine OpenStack Heat. The programming language Python relies on the YAML syntax, but most programming languages can interpret it.
Key-value pairs in YAML
In YAML, key-value pairs are defined and separated with a colon. Keys are unique identifiers to which one or multiple values can be assigned.
Key-value pairs are specified in lists, where one item in the list can be followed by a complete configuration that should be created for that item. For example, items might be parts of a configuration that need to be defined on a computer system or entries to import into a database.
YAML is relatively easy to write. Simple YAML files do not use data formatting items, such as braces and square brackets; instead, most relations among items are defined using indentation.
The syntax of a YAML file is rather strict and relies on indentation. In YAML, each child item of a given parent item is indented by two spaces. Dashes can indicate items in a list.
Blocks do not span multiple lines in the YAML format. YAML users have several options for formatting the data presented by a YAML file, such as mappings, sequences and scalars.
YAML vs. JSON