Try OpenEdge Now
skip to main content
Working with JSON
Parsing and Serializing JSON Objects and Arrays : Introduction to the JSON object model in ABL : JsonArray


The ABL JsonArray is an array collection. It maps integer keys to values. Each key/value pair is called an element, and the only way to access an array element's value is by index in the array. There is a strict order to an array's elements. A JsonArray can grow and shrink in size. Elements can be inserted into and removed from the middle of a JavaScript array.
JavaScript values are loosely typed. That means, the data type of a value within a JavaScript object or array can be changed by setting a new value.
When a property or element is set to null, it loses its data type. In a sense null is a data type (or lack of data type) as well as a value (or lack of value).
Unlike ABL Arrays, JsonArrays can be heterogeneous, meaning that the elements within the array can be of different data types.
The following is an example of building a heterogeneous JsonArray:
myArray = NEW JsonArray().
myArray.Add("jump rope").
myArray:Write(myLongchar, TRUE).
The first three elements are numbers, the fourth element is a boolean, and the fifth element is a string.
The following is the result of myLongchar:
[1, 2, 3, false, "jump rope"].