About YAML file format

A, yaml Profile

  yaml is a language used to write the serialized profile, with some, like json, json yaml also known as a superset of yaml design is for our good readability, mainly for writing configuration information, and json design the purpose is simple and generic to, and is mainly used to store data communication using the application layer data.

Second, the format

  yaml There are three main types of data primitives: Maps, Lists, Scales (according to the official method of expression: " Mappings (hashes / Dictionaries), Sequences (Arrays / Lists) and Scalars (strings / a Numbers)"), based on these three data primitives may be combined with any data structure.

  • Dash and spaces ( -" "): a collection of Lists
  • Colon and a space ( :" "): Maps key-value pairs
  • Pound sign ( #" "): Comment
  • Three dashes ( " ---"): the document content dividing line (used for the place to start documents)
  • Three colon ( ..." "): indicates the end of document
  • Anchor ( " &"), duplicates anchor ( " *"): the expression of both pairs, defined as a variable, then the variable a reference relationship, is a replacement of duplicates.

  yaml scope indented with python based syntax similar, easily retracted configuration of the block data.

Note: yaml file case sensitive, does not allow the use of tabs instead of spaces with a tab symbol.

Third, examples

1, Block Sequences sequence of blocks is a simple series of nodes

block sequence:  
  - one
  - two : three

2, an example of the anchor symbol:

(官方表述:Repeated nodes (objects) are first identified by an anchor (marked with the ampersand - &), and are then aliased (referenced with an asterisk - \*) thereafter. )

---
hr:
  - Mark McGwire
  # Following node labeled SS
  - &SS Sammy Sosa
rbi:
  - *SS # Subsequent occurrence
  - Ken Griffey

Fourth, the end of the

  yaml file format basic syntax introductions.

Guess you like

Origin www.cnblogs.com/aric2016/p/11716961.html