YAML

From Wikipedia, the free encyclopedia

YAML is a human-readable data serialization format that takes concepts from languages such as XML, C, Python, Perl, as well as the format for electronic mail as specified by RFC 2822. YAML was first proposed by Clark Evans in 2001, who designed it together with Ingy döt Net and Oren Ben-Kiki.

YAML is a recursive acronym meaning "YAML Ain't Markup Language". Early in its development, YAML was said to mean "Yet Another Markup Language", retronymed to distinguish its purpose as data-centric, rather than document markup. However since XML (a true document markup language) is frequently used for data serialization, it is reasonable to consider YAML a lightweight markup language.

Contents

YAML was created with the belief that all data can be adequately represented by combinations of lists, hashes (mappings), and scalar (single value) 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. In addition, YAML uses a notation based on indentation and/or a set of sigil characters distinct from those used in XML, making the two languages easily composable.

  • YAML streams are encoded using the set of printable Unicode characters, either in UTF-8 or UTF-16
  • Whitespace indentation is used to denote structure; however tab characters are never allowed as indentation
  • List members are denoted by a leading hyphen ( - ) with one member per line, or enclosed in square brackets ( [   ] ) and separated by comma space ( ,   ).
  • Hashes are represented using the colon space ( :   ) in the form key: value, either one per line or enclosed in curly braces ( {   } ) and separated by comma space ( ,   ).
  • A hash key value is prefixed with a question mark ( ? ), allowing for complex keys to be represented unambiguously.
  • Simple values (scalars) are ordinarily unquoted, but may be enclosed in double-quotes ( " ), or single-quotes ( ' ).
  • Within double-quotes, special characters may be represented with C-style escape sequences starting with a backslash ( \ ).
  • Block scalars are delimited with indentation with optional modifiers to preserve ( | ) or fold ( > ) newlines
  • Multiple documents within a single stream are separated by three hyphens ( --- ); three periods ( ... ) optionally end a document within a stream
  • Repeated nodes are initially denoted by an ampersand ( & ) and thereafter referenced with an asterisk ( * )
  • Comments are denoted by the number sign ( # ) and continue until the end of the line
  • Nodes may be labeled with a type or tag using the exclamation point ( ! ) followed by a string which can be expanded into a URI.
  • YAML documents in a stream may be preceded by directives composed of a percent sign ( % ) followed by a name and space delimited parameters. Two directives are defined in YAML 1.1:
    • The %YAML directive is used to identify the version of yaml in a given document.
    • The %TAG directive is used as a shortcut for URI prefixes. These shortcuts may then be used in node type tags.

YAML requires that colons and commas used as list separators be followed by a space so that scalar values containing embedded punctuation (such as 5,280 or http://www.wikipedia.org) can generally be represented without needing to be enclosed in quotes.

Two additional sigil characters are reserved in YAML for possible future standardisation: the at sign ( @ ) and accent grave ( ` ).

--- # Favorite movies, block format
- Casablanca
- Spellbound
- Notorious
--- # Shopping list, inline format
[milk, bread, eggs, juice]

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

--- |
  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

--- >
  Wrapped text
  will be folded
  into a single
  paragraph
  
  Blank lines denote
  paragraph breaks

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

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

Bindings for YAML exist for the following languages:

Other simplified markup languages include:

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.