Name
json_parse — Takes json string and returns parse tree.
Synopsis
integer
json_parse
(
|
in
txt
varchar
) ; |
Description
This function takes json string and returns parse tree.
Parameters
txt
a json string
Return Types
The function returns tree.
Examples
Example 24.181. Simple example
SQL>create procedure json_tree_example () { declare qr, url, cnt, tree, xt, hdr any; cnt := ' { "head": { "link": [], "vars": ["s", "p", "o"] }, "results": { "distinct": false, "ordered": true, "bindings": [ { "s": { "type": "uri", "value": "http://example.org/node" } , "p": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" } , "o": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }}, { "s": { "type": "uri", "value": "http://example.org/node" } , "p": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" } , "o": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }} ] } }'; tree := json_parse (cnt); tree := get_keyword ('results', tree); tree := get_keyword ('bindings', tree); return tree[0][1]; } ; Done. SQL> SELECT json_tree_example(); json_tree_example VARCHAR structure No. of rows in result: 1
See Also
http
,
http_value
,
http_url
,
string_output
,
http_rewrite
,