Search notes:
Oracle JSON Object Types: Method PUT
declare
jsn json_object_t;
begin
jsn := json_object_t.parse(q'<
{
"num": 7,
"txt": "hello world!"
}
>');
jsn.put('num' , 42);
jsn.put('xyz' , 'this key was added with .put()');
jsn.put('ary' , json_element_t.parse('[1,1,2,3,5,8,13]'));
dbms_output.put_line(jsn.stringify(pretty=>true));
-- Parameter pretty in stringify only available in 23c.
-- dbms_output.put_line(jsn.stringify);
end;
/
--
-- {
-- "txt" : "hello world!",
-- "num" : 42,
-- "xyz" : "this key was added with .put()",
-- "ary" :
-- [
-- 1,
-- 1,
-- 2,
-- 3,
-- 5,
-- 8,
-- 13
-- ]
-- }