Removes an element with the specified index from a JSON array. The index of all following elements decreases by one. Also the size of the array decreases by one.
Json.bdh
JsonArrayRemoveElement( in handle : number, in index : number ): boolean;
Parameter | Description |
---|---|
handle | Valid handle to a JSON array |
index | The index position in the JSON array. Lower bound is zero (0). |
transaction TMain var jsonArray, i, current : number; begin jsonArray := JsonParse("[0,1,2,3,4,5,6,7]"); //remove all even numbers of array i := 0; while i < JsonGetArrayLength(jsonArray) do JsonArrayGetNumberElement(jsonArray, i, current); if ((curr mod 2) = 0) then JsonArrayRemoveElement(jsonArray, i); else i := i + 1; end; end; JsonFree(jsonArray); end TMain;