yaml key

The yaml key type represents a key-value pair in a YAML object.

For example, in the following YAML object foo is the key and bar is the value:

{
  "foo": "bar"
}

Since YAML allows for nesting, the value in a key-value pair could also be another YAML object. For example { "foo": { "bar": "baz" } }, or { "pairs": { three: 3, pi: 3.14 } }.

However, in our implementation, we adopt a slightly different definition of the terms "key" and "value". The entire "YAML object" is a yaml value. Each key-value pair inside it is a yaml key. The "key" in a key-value pair is just a string and we refer to it as the "name of the key". The "value" in a key-value pair is another yaml value.

If a yaml value only contains a simple value, it can be cast to a base type. Otherwise, it contains other yaml key key-value pairs.

The whole { "foo": "bar" } is represented as a yaml value. The key-pair "foo": "bar" inside it is represented as a yaml key. The key "foo" is returned as the name of the yaml key and it is represented as a string. The value "foo" is returned as the value of the yaml key and it is represented as yaml key, but it can be cast to string because that is what it contains.

Our YAML parser is implemented using the yaml-cpp library, available at https://github.com/jbeder/yaml-cpp.

The parser also supports the inline (non-indented) versions of objects and arrays, allowing YAML structures to be defined in a more compact format.

Note: For certain characters, such as double quotes, newline characters, and others, we use URL encoding (or percent encoding) to ensure proper handling within the text.

For more details about how the yaml value is represented, refer to the YAML value page.

Version Platforms
11.0.5.0 AIX, Debian, Mac, Raspbian, Red Hat, SUSE, Solaris, Ubuntu, Windows

Creation

key <string> of <yaml value> : yaml key
key of <yaml value> : yaml key

Properties

name of <yaml key> : string
value of <yaml key> : yaml value

Casts

<yaml key> as string : string

Operators