Contact US

[email protected]

One benefit of this format, which you might see immediately, is that there are no more curly or square brackets. YAML can be considered a superset of JSON with a few extra features such as comments, anchoring, and aliasing. Simply precede a line in the file with a # character and it is considered a comment. Anchoring and aliasing has to do with removing the necessity to duplicate data throughout the file. Also, the alias simplifies updates to an attribute, where the change needs to only happen in a single place, instead of multiple ones.

Session:
  # This is a comment
  Scenario: &scenario TikTok
    Counter: 5
    Electrode: AF3
    THETA: 9.681
    ALPHA: 3.849
    GAMMA: 0.738
  Scenario: *scenario
    Counter: 6
    Electrode: Pz
    THETA: 8.392
    ALPHA: 4.142
    GAMMA: 1.106

Notice that the first instance of Scenario: is followed by an ampersand, &, then the name of the identifier followed by the value. In all future locations where this same value is needed, enter the identifier preceded with a star instead of placing the actual value. YAML isn’t prime time yet and not the primary choice for doing Big Data analytics. But it is up and coming and worthy of being called out. The best uses of YAML include when you have been using JSON but want the additional features available in YAML.