JBUILD() |
|
|
The JBUILD() function constructs a JSON string from a data collection.
Format
JBUILD(var) JBUILD(var, mode)
where
The JBUILD() function transforms the content of a QMBasic data collection variable into a JSON (JavaScript Object Notation) string. If successful, the JSON string is returned as the value of the function and the STATUS() function returns zero.
If the JBUILD() function fails, a null string is returned and the STATUS() function returns ER$BUILD.ERROR. Failure will occur if the data collection contains any elements that do not have a JSON representation such as a file variable.
Example
VAR = JPARSE(JSON.STRING) VAR{'client/name'} = NEW.CLIENT.NAME JSON.STRING = JBUILD(VAR)
The above program fragment parses a JSON string into a data collection variable, modifies the client name element and rebuilds the JSON representation of the modified data.
See also: |