Following global functions are defined:
Converts JSON string to an Euphoria sequence
Params:JSON sequence to parse
hierarchical sequence of all JSON elements
s = "{\"key1\" : {\"key1.1\" : 2}, \"key2\" : 2}"
elements = json_to_sequence(s)
elements =
. [1]
. . [1] "key1"
. . [2]
. . . [1]
. . . . [1] "key1.1"
. . . . [2] 2
. [2]
. . [1] "key2"
. . [2] 2
Returns the value of a JSON item
Params:JSON item name to search for
JSON sequence converted to an Euphoria sequence by json_to_sequence()
value to return when search fails
an object: value of found JSON element
s = "{\"key1\" : {\"key1.1\" : 2}, \"key2\" : 2}"
get_json_value("key1.1", s, 0) is 2
Returns all the values of a JSON item
Params:JSON item name to search for
JSON sequence converted to an Euphoria sequence by json_to_sequence()
value to return when search fails
a sequence: values of found JSON elements
s = "{\"objects\": [" &
"{\"id\": 1, \"label\": \"lbl1\"}," &
"{\"id\": 2, \"label\": \"lbl2\"}," &
"{\"id\": 3, \"label\": \"lbl3\"}," &
"{\"id\": 4, \"label\": \"lbl4\"}" &
"]}"
get_all_json_values("id", s) is {1,2,3,4}