Try OpenEdge Now
skip to main content
ABL Reference
Class Properties and Methods Reference : AddNull( ) method (JsonArray)
 

AddNull( ) method (JsonArray)

Creates one or more new elements with a null value and adds them at a specified index or to the end of the JsonArray.
This method is useful in situations where you know at compile time to add JSON null values. To use one of the Add( ) overloadings, you must set a variable to the Unknown value (?) first, then call Add( ) with the variable. Using the Unknown value (?) value as a constant in one of the Add( ) overloadings causes a compilation error because the compiler is unable to resolve the overloading to be used.
On successful completion, this method returns the index of the last newly added element.
Return type: INTEGER
Access: PUBLIC
Applies to: Progress.Json.ObjectModel.JsonArray class

Syntax

AddNull ( )

AddNull ( INPUT count AS INTEGER )

AddNull ( INPUT index AS INTEGER ,
         INPUT count AS INTEGER )
With no parameters present in the method, one JSON null element is added to the end of the JsonArray and the JsonArray:Length property is incremented by 1.
count
An INTEGER indicating the number of elements to add to the JsonArray. Each element is initialized to the JSON null value. JsonArray:Length is incremented by count.
If count is less than 1, or is the Unknown value (?), a JsonError is raised.
index
An INTEGER identifying the element after which the new element or elements are added. Indexing into JsonArrays is 1-based. For example, myArray:AddNull(5, 3) inserts three JSON null values as elements 6, 7 and 8 into the JsonArray. All elements starting with the original sixth element are shifted by three positions.
If the index is 0, the new element is inserted at the beginning of the array making that new elements index 1. If the index is not provided, the default behavior is to add new elements to the end of the array.
If index is the Unknown value (?), or less than 0, or greater than the length of the array, a JsonError is raised.