Skip to content

Expressions: Literals

Literals in expressions denote constant values.

Numbers

Numeric literals are always of type number. Numeric values can be specified in decimal form, such as 123.2. Integer numeric values can also be specified in hexadecimal form by prefixing them with 0x, or in octal form by prefixing them with 0o. For example, 0x12 is equivalent to 18 in decimal form, and 0o52 is equivalent to 42 in decimal form.

Strings

String values of type string can be specified inside quotation marks. For example:
The string value hello can be denoted as the string constant "hello"

To include a quotation mark inside a string, prefix it with a backslash (\"). For example:
The string value this is a quotation mark: " can be denoted as the expression "this is a quotation mark: \""

To include a backslash inside a string, prefix it with a backslash (\\). For example:
The string value path\subpath can be denoted as the expression "path\\subpath"

Null

null is a reserved keyword indicating a lack of value. For example, {"key": null} will create a JSON object with a null value for key.

The null observes Boolean semantics of having value false. For example, let x = null return x ? 1 : 0 will return 0.

Boolean

true and false are reserved keywords indicating Boolean true and false, respectively.