Tuesday, July 16, 2019

YAML

YAML Ain't Markup Language:
  1. YAML uses indentation to distinguish layers (same indentation - same layer) - use spaces, because tabs are not allowed.
  2. YAML start with three dashes: ---
  3. YAML disctionary in key-value pair in one of two forms:
    1. colon separated key (like Python dictionary):
      1. key: value
    2. indentation separated key:
      1. key:
      2.       value
    3. Also one key can contain nested dictionary:
      1. Method 1:
        1. first_level_key:
        2.    second_level_key_under_the_first_level: second_level_value
      2. Method 2:
        1. first_level_key: {second_level_key_under_the_first_level: second_level_value}
  4. YAML uses dashes as indentation to represent list of items (use lists when you want key to have more than one values which are not keys themselves):
    1. Methos 1:
      1. this_is_a_list:
      2.  - element_1
      3.  - element_2
    2. Method 2:
      1. this_is_a_list : [element_1, elemenet_2]

No comments:

Post a Comment