YAML Syntax

2.1.2. YAML Syntax#

Basic Structure
  • Key-Value Pairs:

    name: John Doe
    age: 30
    
  • Nested Structures:

    person:
      name: John Doe
      age: 30
    
Strings
  • String Formatting:

    greeting: "Hello, World!"
    farewell: 'Goodbye!'
    
  • Multiline Strings:

    descr: |
      A multiline string.
      Retains line breaks.
    

Abbreviated forms

Lists and Dictionaries can be condensed:

  • start = ["a", "b"]

  • user = {name: John, job: Developer}

Lists
fruits:
  - Apple
  - Banana
  - Cherry
Comments
# A comment
name: John Doe  # Also a comment