YAML
YAML is a
recursive acronym for "YAML Ain't
Markup Language". YAML is a data serialization language that takes concepts from languages such as
XML,
C,
Python, and
Perl, as well as the format for electronic mail as specified by
RFC 2822. YAML was first proposed by Clark Evans, and implemented by himself, Brian Ingerson and Oren Ben-Kiki.
Features
YAML was created with the belief that all data can be adequately represented by combinations of lists, hashes, and scalar data. The syntax is relatively straightforward and was designed with human readability in mind, but also to be easily mapped to data types common to most high-level languages:
- Comments are denoted by the pound sign (#) and continue until the end of the line\n* List members are denoted by a leading hyphen (-) with one member per line, or as comma-separated values enclosed in brackets ([ & ])\n* Hashes are represented in the form key: value, either one per line or enclosed in parentheses (( & )) and delimited by commas\n* Scalars may be double-quoted ("), single-quoted ('), or represented by an indented block with optional modifiers to preserve (|) or fold (>) newlines\n* Multiple documents within a single stream are separated by three hyphens (---); three periods (...) optionally end a document within a stream\n* Repeated nodes are initially denoted by an ampersand (&) and thereafter referenced with an asterisk (*)
Examples
Lists
--- # Favorite movies, block format\n - Casablanca\n - Spellbound\n - Notorious\n --- # Shopping list, inline format\n [milk, bread, eggs]
Hashes
--- # Block\n name: John Smith\n age: 33\n --- # Inline\n (name: John Smith, age: 33)
Block Literals
Newlines preserved
--- |\n There was a young fellow of Warwick\n Who had reason for feeling euphoric\n For he could, by election\n Have triune erection\n Ionic, Corinthian, and Doric
Newlines folded
--- >\n Wrapped text\n will be folded\n into a single\n paragraph
Blank lines denote\n paragraph breaks
Lists of Hashes
- (name: John Smith, age: 33)\n -\n name: Mary Smith\n age: 27
Hashes of Lists
men: [John Smith, Bill Jones]\n women:\n - Mary Smith\n - Susan Williams
Implementations
Bindings for YAML exist for the following languages:\n* Javascript\n* Perl\n* PHP\n* Python\n* Ruby\n* XML (currently draft only)
External links
\n* YAML.ORG\n* YAML Specification\n* YAML Cookbook\n* YAML in Five Minutes