The Any (JSON) Variable Data Type The Any (JSON) Variable Data Type

The Any (JSON) Variable Data Type

Adam Evans Adam Evans
The Object Airkit type is used to group together a set of named values called keys. Each value will be associated with a key, later that value can be retrieved by the same key. An Object is created by a comma separated list of pairs where a name is separated from the value by a colon, enclosed in curly brackets. For example if we wanted to pair foo with 1, bar with 2, and baz with 3 we would write the following Airscript.
{
foo: 1,
bar: 2,
baz: 3
}
Alternatively, instead of just using the keyword foo, a string may be provided. The following Airscript expression will produced the same value as that from the previous example.
{
"foo": 1,
"bar": 2,
"baz": 3
}
This syntax is useful if a key must contain a character that isn't normally allowed in identifiers for example the key foo-bar must be entered with a string because the - character is not allowed.
{
"foo-bar": 1
}
Using strings as keys also allows one to create objects that have dynamic keys. For example if there is a String Variable named dynamic_object_key that holds a the string "foo", one can use

In order to retrieve the value associated with foo we append a . and then the text foo.
my_record.foo
Alternatively, records can also be accessed similarly to lists so we may also access the value associated with foo like so:
my_record["foo"]