Hi, I am new to JSON. I would like to parse a given JSON string and insert the data into the Database. Are there any examples ?
Thanks
Naresh
Here's a small example that parses a JSON string. The given JSON string is a representation of an object that has two properties: one with a string value and a second with an array value.
declare str varchar2(255) := '{"foo":"bar","nums":[1,2,3,4]}'; json_obj json; json_lst json_list; begin json_obj := json(str); -- convert the JSON string to an object json_lst := json_list(json_obj.get('nums')); dbms_output.put_line('foo = ' || json_obj.get('foo').to_char); for i in 1..json_lst.count loop dbms_output.put_line( json_value.get_number(json_lst.get(i)) ); end loop; end; /
Thanks. That was really simple.
No problem. Glad it helped.
Yeah, thanks for this. Helped me too.
Log in to post a comment.
Hi,
I am new to JSON. I would like to parse a given JSON string and insert the data into the Database. Are there any examples ?
Thanks
Naresh
Here's a small example that parses a JSON string. The given JSON string is a representation of an object that has two properties: one with a string value and a second with an array value.
Thanks. That was really simple.
No problem. Glad it helped.
Yeah, thanks for this. Helped me too.