How many types of Collections in YAML?

Category: YAMLHow many types of Collections in YAML?
Editor">Editor Staff asked 2 years ago

How many types of Collections in YAML?

1 Answers
Editor">Editor Staff answered 2 years ago

Collections are of two types like

  • Lists
  • Map or Dictionaries

Lists – The elements in the list are denoted by the syntax hyphen and space
– Fresco play
– Lynda
– Skillsoft
– Safari
Maps or Dictionaries will be in the form of Key: Value pair.
Maps or Dictionaries
Maps can also be nested as follows
nested_map1:  key1:  value1  key2:  value2  nested_map2:  key1:  value1
Maps don’t have string as keys
You can also have key with multiple lines by using the following syntax:
? |  This is a key  which has multiple lines:  its value
Sequences can be defined as (lists or arrays) .
sequence1:   – Item 1   – Item 2  – 0.5   # sequences can contain disparate types.  – Item 4  – key: value    another_key: another_value    – sequence1    – sequence2