JPARSE()

JPARSE()

Top  Previous  Next

 

The JPARSE() function parses a JSON string into a data collection.

 

 

Format

 

JPARSE(var)

 

where

 

varis a JSON string.

 

 

The JPARSE() function transforms a JSON (JavaScript Object Notation) string into a data collection variable. If successful, the return value of the function is a data collection and the STATUS() function returns zero.

 

If the JPARSE() function fails, a null string is returned and the STATUS() function returns a non-zero error code. The INMAT() function will return the character position in the JSON string at which the error was detected.

 

 

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:

Data collections, JBUILD()