DataMiner YAML Syntax

YAML overview with specific examples

We use chose YAML because it is easier for humans to read and write than other common data formats like XML or JSON.

YAML Basics

Key points

  • Alignment is important and spaces matter: if it looks good it's probably OK.

  • Everything to the right of a # is a comment.

  • Lists of elements (iterations) start with a '-'.

Every YAML file has lists. Each item in the list is a list of key/value pairs. All members of a list are lines beginning at the same indentation level starting with a "- " (a dash and a space):

# A list of tasty fruits
- Apple
- Orange
- Strawberry
- Mango

A dictionary is represented in a simple key: value form (the colon must be followed by a space):

# An employee record
Employee:
  name: Martin D'vloper
  job: Developer
  skill: Elite

More complicated data structures are possible, such as lists of dictionaries, dictionaries whose values are lists or a mix of both:

# Employee records
- martin:
    name: Martin D'vloper
    job: Developer
    skills:
      - python
      - perl
      - pascal
- tabitha:
    name: Tabitha Bitumen
    job: Developer
    skills:
      - lisp
      - fortran
      - erlang

Dictionaries and lists can also be represented in an abbreviated form if you really want to:

martin: {name: Martin D'vloper, job: Developer, skill: Elite}
fruits: ['Apple', 'Orange', 'Strawberry', 'Mango']

Values can span multiple lines using >. It’s used to make what would otherwise be a very long line easier to read and edit.

fold_newlines: >
            this is really a
            single line of text
            despite appearances