YAML Realm

Log In

Main Page

Linux Page

Photo Page

Code Page

5. Value types Page

Code Project -- Working with YAML syntax

YAML syntax (YAML Ain't Markup Language) is a text-based data format with label-value pairs usually separated with either a colon or new indented line. Its simple syntax makes reading and understanding the data and it relationships easy.

This page has been viewed 230 times.

1. Basic syntax

The simplest YAML syntax has each key mapped to a value. A : will separate the two parts of the map. Any line with a - after the indent and before the value marks a run. A map will have no set order, while runs are ordered by occurrence. The value could be another map or run indented within.

Continue...

2. Longer values

The YAML syntax allows for values to span multiple lines with > or | and further line indent. A > will collapse the indented block, while a | will preserve block formating.

Continue...

3. Concise syntax

The YAML syntax also allows for a more concise map and run format. A run can be defined with [value,value,...]. A dictionary can be defined by {label:value,...}.

Continue...

4. Alias syntax

The YAML syntax has the ability assign an alias with &alias prior to the values. The alias can then reference the value anywhere after with *alias.

Continue...

5. Value types

The YAML syntax does not usually need to define value types. Quotes are not even required around a value, except when using a reserved format character. Values may be assigned a type though special syntax proceeding the value being declared.

Continue...


Contact with Questions or Feedback: Send email to tjaustinbardo AT gmail DOT com

Creative Commons Attribution-NonCommercial-ShareAlike License

modified: June 16, 2011, at 02:19 PM