JSON_ArraySetLength
%JSON_ArraySetLength function
Function
Sets the length of an array.
Declaration
%JSON_ArraySetLength(
INT in handle,
INT in length
)Parameters
handle | Handle to JSON array. |
length | New length of array |
Return value
None
Description
The function sets the array length to the specified value. If the new length is less than the original, the items at the end of the field will be deleted. If the new length is greater than the original array length, the New Items will be set to null.
If it is an invalid handle on a JSON array or the specified length is less than 0, an exception is thrown.
Example
INT _arr
_arr := %JSON_CreateArray()
%JSON_ArraySetLength(_arr, 2)
%JSON_ArraySetValue(_arr, 1, 1.234)
%JSON_ArraySetValue(_arr, 2, 3.142)
%JSON_FreeArrayHandle(_arr)