2

In Oracle 21c, it looks like we can return a resultset as JSON text:

SELECT json_object(*)
from dual;
result:
{"DUMMY":"X"}

That works in db<>fiddle:

enter image description here

Question:

Is there a way to return the JSON text using pretty formatting?

{
 "DUMMY":"X"
}

Related: Select JSON text of SDO_GEOMETRY using SQL

asked Jan 2, 2022 at 17:24

1 Answer 1

5

As documented, you can add PRETTY to a JSON function to prettify it

SELECT json_object(* PRETTY)
from dual;

db<>fiddle

Output

{
 "DUMMY" : "X"
}
answered Jan 2, 2022 at 17:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.