jsonFree (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

2.10.00


jsonFree releases the resources used by a JSON object or array.

 

 

Input:

o : SYSHANDLE

A handle to the JSON object or array to release. Will be made invalid once it has been released.

 

 

Returns: INT

1

- Success

0

- Function is not supported.

-3

- JSON structure was not found.

 

 

Declaration:

FUNCTION jsonFree : INT;
VAR_INPUT
  o     : ACCESS SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc  : INT;
  arr : SYSHANDLE;
  obj : SYSHANDLE;
END_VAR;
 
BEGIN
  ...
  // Create array
  rc := jsonCreateArray(o := arr);
  // Add integer
  rc := jsonAddValueInt(o := arr, value := 123);
  // Create object
  rc := jsonCreateObject(o := obj);
  // Add integer to object
  rc := jsonSetValueInt(o := obj, key := "Number", value := 42);
  // Replace integer in array with object
  rc := jsonSetValue(o := arr, idx := 0, value := obj);
  // Release object handle
  rc := jsonFree(o := obj);
  ...
END;
 
END_PROGRAM;