JavaScript Object Notation (JSON) Functions
The following routines are used to manipulate JavaScript objects as strings and
are available when importing the librxjson.so library with
CALL import "librxjson.so".
For more information on json formating look at json.org
JSON(json, name [,start])
return value of parameter name from a json object.
The searching of the parameter starts from index start
call json('{"a":null,"b":[1,2,3]}','b') | /* return "[1,2,3]" */
|
JSONARRAY(json [,idx [,start]])
return the idxelements in a json array, or the size
of the array if idx is not specified. Optionally can start
searching the idx elements from the start position
say jsonarray('[1,{"a":2},3]',2) | /* return '{"a":2}' */
|
JSONESC(str)
escape special characters in str object by backslash "\" to be
used as values in a json object
say jsonesc('hello"there) | /* return 'hello\"there' */
|
JSONFIND(json, name [,start])
return the position of parameter name from a json object.
The searching of the parameter starts from index start
call jsonfind('{"a":null,"b":[1,2,3]}','b') | /* return 11 */
|
JSONTYPE(json, pos)
return the type of the json object at location pos
call jsontype('{"a":null,"b":[1,2,3]}',15) | /* return "array" */
|
JSONVALUE(json, pos)
returns the vaule of the json object at location pos
Sends the data to socket fd. It returns the number
call jsonvalue('{"a":null,"b":[1,2,3]}',15) | /* return "[1,2,3]" */
|