In the realm of JSON serialization, Oracle Database 23c has introduced a new feature: the ORDERED keyword in the JSON_SERIALIZE function. This latest feature allows users to exert complete control over the serialization order of JSON members by arranging them in ascending alphabetical order, based on their field names. In this blog post, we will learn how to leverage it. Code declare
l_json json;
l_clob clob;
begin
l_json := json('{
"empno":7839,
"ename":"KING",
"job":"MANAGER",
"mgr":1,
"sal":5000,
"deptno":10
}');
select json_serialize(l_json pretty ordered ) into l_clob;
dbms_output.put_line( l_clob);
end;
/