@JsonRelease
Syntax
@JsonRelease(HJSON);
Description
This @Function releases a previously created VSPECHJSON (HJS) handle.
The function decreases the reference count of the JSON object or array referenced by HJSON. If the reference count reaches zero, the JSON structure and all JSON values owned by it are released.
After successful execution, the JSON handle stored in HJSON is set to NULL and must no longer be used with other JSON functions.
If the same JSON object or array is referenced by other JSON handles or contained in another JSON structure with its own reference, those references remain valid.
Every VSPECHJSON (HJS) handle returned by functions such as @JsonCreate, @JsonLoad, or @JsonGet must eventually be released with @JsonRelease.
VSPECHJSON HJSON:
Handle of the JSON object or array to release.
HJSON must contain a valid VSPECHJSON (HJS) handle referencing either a JSON object or a JSON array.
As return value, the @Function returns @ERROR on failure; otherwise, it returns TRUE.
Example: @JsonRelease(HJSON);
HJSON:=@JsonCreate;
@JsonAdd(HJSON;"Max Mustermann";"Name");
@JsonAdd(HJSON;42;"Age");
JSONTEXT:=@JsonSerialize(HJSON);
@JsonRelease(HJSON);
The example creates a JSON object, adds two values, and converts the resulting JSON structure to its textual representation.
The generated VSPECHJSON (HJS) handle is then released with @JsonRelease and must not be used afterwards.
The resulting JSON text before releasing the handle is:
{"Name":"Max Mustermann","Age":42.0}
Note : This text was machine-translated and may contain inaccuracies.
