How can I retrieve content from below json by using pl/sql json from http://sourceforge.net/projects/pljson/?
{"errors":["Invalid weight","Invalid pallet spots"]}
I want to get text like this 1. Invalid weight, 2. Invalid pallet spots.
Thanks
How can I retrieve content from below json by using pl/sql json from http://sourceforge.net/projects/pljson/?
{"errors":["Invalid weight","Invalid pallet spots"]}
I want to get text like this 1. Invalid weight, 2. Invalid pallet spots.
Thanks
This is actually quite simple:
DECLARE
obj json := json();
arr json_list := json_list();
BEGIN
obj := json('{"errors":["Invalid weight","Invalid pallet spots"]}');
arr := json_list(obj.get('errors'));
dbms_output.put_line(arr.get(1).get_string());
dbms_output.put_line(arr.get(2).get_string());
END;
/
You might also want to have a look at my own (performance optimized) version of a json library for PL/SQL @ https://github.com/doberkofler/PLSQL-JSON