JSON basics
- Last Updated: June 22, 2023
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
This topic provides a brief overview of JSON.
For more information about JSON, start with the JSON Web site,https://www.json.org/. This site includes basic information about JSON and links to other sites describing support for JSON in various languages and applications.
JSON data types
ABL requires the data to be either an object or an array. Because JSON is designed to be lightweight, it supports only four primitive data types, as shown in the following table.
| Data type | Description | Examples |
|---|---|---|
|
string |
A string of Unicode characters enclosed in double quotes. A backslash ( \ ) serves as the escape character. | "jump rope" |
| number | An unquoted numeric value, which can include an exponent | 1754.350.9582e-42 |
| boolean | An unquoted lowercase literal string of true or false | true |
| null | An unquoted lowercase literal string of null | null |
The data type of a value is determined by the format of the value. In addition to these primitive data types, there are some non-standard data types in common usage for certain values. For more information about ABL support of non-standard data types, see Data type mapping.
JSON also supports two complex data types, as shown in the following table:
| Data type | Description | Examples |
|---|---|---|
| Object | A comma-delimited list of named values, either simple or complex, enclosed in braces | { "myString" : "jump rope", "myNum" : 17, "myBool" : false } |
| Array | A comma-delimited list of unnamed values, either simple or complex, enclosed in brackets | [ "jump rope", 17, false ] |
Simple values
A simple value is a name/value pair. The name is always quoted and separated from the value by a colon, as shown:
|
The exception to this is the list of values in an array, as shown in the above table. In an array, you access a particular value by a numeric index, rather than by a name.
Complex values
JSON enables you to name objects and arrays and combine them into complex values. A complex value combines simple values to represent more complicated data. The following example shows an object made up of other objects and arrays:
|