....
If you prefer formatted output, use JSON_SERIALIZE(expr PRETTY)
....However since 12.2 JSON_QUERY also support the PRETTY formatting of JSON documents.
demo@ORA12C> select data from json_documents ;
DATA
------------------------------------------------------------
{"id":1,"first_name":"Iron","last_name":"Man"}
demo@ORA12C> select json_query( data, '$' pretty ) from json_documents;
JSON_QUERY(DATA,'$'PRETTY)
-----------------------------------------------------------------------------
{
"id" : 1,
"first_name" : "Iron",
"last_name" : "Man"
}
demo@ORA12C>