jsonAddValueInt adds the provided integer to the end of the given JSON array, growing the size of the array by 1.
Input:
o : SYSHANDLE
A handle to the JSON array to add the value to.
value : DINT
The value to add.
Returns: INT
1
|
- Success.
|
0
|
- Function is not supported.
|
-3
|
- Invalid handle.
|
-4
|
- Not an array
|
-6
|
- Not enough resources available to add value.
|
-99
|
- Failed to add value
|
Declaration:
FUNCTION jsonAddValueInt : INT;
VAR_INPUT
o : SYSHANDLE;
value : DINT;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM test;
VAR
rc : INT;
arr : SYSHANDLE;
obj : SYSHANDLE;
END_VAR;
BEGIN
...
rc := jsonCreateArray(o := arr);
rc := jsonAddValueInt(o := arr, value := 123);
rc := jsonCreateObject(o := obj);
rc := jsonSetValueInt(o := obj, key := "Number", value := 42);
rc := jsonSetValue(o := arr, idx := 0, value := obj);
rc := jsonFree(o := obj);
...
END;
END_PROGRAM;
|