%JSON_ArraySetLength function


Function

Set length of array.

Declaration
%JSON_ArraySetLength(
    INT in handle, 
    INT in length
 )
Parameters
handleHandle to JSON array.
lengthNew length of array
Return value

None

Description

Function set length of array. If new length is greater than previous, items at the end of array will be set to null. If new length is smaller than previous, item at then end of array will be removed.

Exception is thrown if handle to JSON array is invalid or length is lower than 0.

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)
Napíšte komentár