Oracle JSON_OBJECT_T To Clob
You're using get_clob()
which gets a specific key value.
You can use to_string()
or to_clob()
to serialize the entire JSON object to a single string value:
Serialization is the inverse of the parse function. The serialization operation takes the in-memory representation of the JSON data and prints it to a string. The serialization functions and procedures are:
MEMBER FUNCTION to_String RETURN VARCHAR2 ... MEMBER FUNCTION to_Clob RETURN CLOB ...
So for your code:
P_CLOB := V_JSON_OUT.TO_CLOB; DBMS_OUTPUT.put_line(P_CLOB);
Using the HR-schema version of that table, which already has an ID 123, that prints out:
{"firstname":"Shanta","lastname":"Vollman","salary":6500}