Any (JSON)
The Any
Data Type refers to any of JSON's basic value types. This includes:
Numbers
Strings
Booleans
Arrays
Objects
All of Airscript's primitive types fall under the umbrella of one of these types. Sometimes there is a one-to-one correspondence. For instance, Booleans in Airscript are Booleans in JSON, and Lists in Airkit are Arrays in JSON. In other cases, a broad category in JSON encompasses several more specific Data Types in Airscript. For instance, Emails and Phones in Airscript are types of string in JSON, and Currencies, DateTimes, and Assets (just to name a few) are types of JSON object.
Because Airkit's primitive types fall under the umbrella of one of JSON's basic value types, the Data Type Any
can refer to any of Airkit's Data Types. In the vast majority of cases, Airscript's syntax matches JSON's.
Structure
The value of an Any
Data Type can be structured in many different ways. Because the Type cannot be used to indicate how the value can be used, a rigid syntax structure is used to define the capabilities of the value:
Numbers - consist only of number characters, periods to represent decimal points, and dashes prefacing negative values. Numbers encompass both integers and floating-point values.
Strings - can consist of any combination of characters. Strings are encompassed by quotation marks.
Booleans - have two potential values:
TRUE
andFALSE
.Arrays - group together any number of other values, of any Data Type. Lists are delineated by square brackets; values are separated by commas.
Objects - any number of key-value pairs, separated by commas. Objects are delineated by curly brackets.
Examples
Numbers
Numbers include both integers and floating-point values. The following example is of an integer Number value:
The following example is of a floating-point Number value:
Strings
Strings can consist of any combination of characters, as long as they are delineated by quotation marks:
Booleans
A Boolean can have one of two potential values, TRUE
or FALSE
. JSON represents them as
and
respectively.
Arrays
Arrays are delineated by square brackets. They group together values of any Type, which are separated by commas. For instance, the following Array groups together the Numbers 1, 2, and 3:
Arrays do not have to contain values of the same Type. For instance, the following Array contains a Number (1), a String (2), a Boolean (false) and a List ([1, 2, 3]):
Objects
Objects consist of any number of key-value pairs, separated by commas. They are delineated by curly brackets. For example, the follow Object has two keys ("first_name" and "last_name"), and each key is associated with a different value ("first_name" is associated with "Alice" and "last_name" is associated with "Smith":
The values in the key-value pairs can be any Data Type. For instance, the following Object has three keys, and each is associated with a value of a different Data Type:
Last updated