When I run the following query in an Oracle Database 26.2.0
select json_serialize(
json(
'{
"xyz": [],
"configs": [],
"z": 1,
"a": 2
}'
)
returning clob
ordered
);
I get this correctly ordered result:
{"a":2,"configs":[],"xyz":[],"z":1}
When I add the pretty option to the json_serialize function, the result is pretty printed, but the order of the object members is wrong. Here's the query:
select json_serialize(
json(
'{
"xyz": [],
"configs": [],
"z": 1,
"a": 2
}'
)
returning clob
pretty
ordered
);
and the wrong result:
{
"a" : 2,
"z" : 1,
"configs" :
[
],
"xyz" :
[
]
}
I get the same result in Autonomous Database with version 23.26.3.1.0.
I would expect the following as in the result without the pretty option.
{
"a" : 2,
"configs" :
[
],
"xyz" :
[
],
"z" : 1
}
IMO this is a bug since the documentation says that you combine ordered with pretty.
