YAML

from Wikipedia, the free encyclopedia
YAML
File extension : .yml, .yaml
MIME type : not registered
Initial release: May 11, 2001
Current version: 1.2 (as of October 1, 2009)
Type: Data exchange
Website : yaml.org


YAML [ jæməl ] is a simplified markup language ( English Markup Language ) for data serialization , modeled on XML (originally) and the data structures in the languages Perl , Python and C , as well as the in RFC 2822 featured e-mail format. The idea for YAML came from Clark Evans in 2001, the specification was created by himself, Brian Ingerson and Oren Ben-Kiki.

YAML is a recursive acronym for “YAML Ain't Markup Language” (originally “Yet Another Markup Language”).

Design goals

The basic assumption of YAML is that any data structure can only be represented with associative lists , lists ( arrays ) and single values ( scalars ). This simple concept makes YAML much easier to read and write by people than, for example, XML, and it also simplifies further processing of the data, since most languages ​​have already integrated such constructs.

Examples

Note:

  • The symbol introduces #single-line comments and ---marks the beginning of a new section.
  • A comment in the same line as ---can cause problems when reading the YAML file - for reasons of clarity, however, it is still in the same line in the example.

Lists:

--- # Favorite movies, block format
- Casablanca
- Spellbound
- Notorious
--- # Shopping list, inline format
[oats, bananas, nuts]

Associative lists:

--- # Block
name: John Smith
age: 33
--- # Inline
{name: John Smith, age: 33}

Block expressions in which line breaks are retained:

--- |
  There was a young fellow of Warwick
  Who had reason for feeling euphoric
      For he could, by election
      Have triune erection
  Ionic, Corinthian, and Doric

Block expressions in which individual line breaks are changed to spaces:

--- >
  Wrapped text
  will be folded
  into a single
  paragraph

  Blank lines denote
  paragraph breaks

List of associative lists:

- {name: John Smith, age: 33}
- name: Mary Smith
  age: 27

Associative list of lists:

men: [John Smith, Bill Jones]
women:
  - Mary Smith
  - Susan Williams

Implementations

YAML implementations exist for the programming languages C , C ++ , JavaScript , ActionScript , Perl , PHP , Python , Java , R , Ruby , Rust as well as for the .NET platform.

Similar techniques

Similar formats for configuration files are INI and TOML .

With JSON a similar technique, the more the existing object model ( DOM is oriented) and from the programming language JavaScript comes. JSON is a real subset of YAML: Every JSON document is a valid YAML document in version 1.2 of YAML. The EDN format comes from the Clojure world and uses an expandable syntax based on JSON.

There is also a text-based alternative for the graphic notation language UML (version 2), which is designed for easy readability for people - the Human-Usable Textual Notation (HUTN). The metamodel of UML and HUTN is each MOF , so that HUTN can display any UML diagram as easy-to-read text. The ease of readability distinguishes HUTN from the XMI format, which is intended for data exchange between UML applications.

Web links

Individual evidence

  1. YAML Ain't Markup Language (YAML ™) Version 1.2. Retrieved June 22, 2019 .
  2. Clark C. Evans: YAML Draft 0.1. May 11, 2001, Retrieved June 22, 2019 (Newsgroup, now on Yahoo Groups).
  3. ^ R YAML package. In: Department of Biostatistics. Vanderbilt University, January 20, 2012, accessed January 26, 2018 .
  4. David Tolnay: Crate serde_yaml. Retrieved July 1, 2020 .
  5. YAML Ain't Markup Language (YAML) Version 1.2