Newer to working with JSON and newly upgraded Oracle 19c DB. I'm receiving a JSON array back from an api and storing it in an Oracle 19c table column with IS JSON (STRICT) constraint.
[ {"key1":"valueA", "key2":"valueB"}, {"key1":"valueC", "key2":"valueD"} ]
I need to select values in column form:
KEY1 KEY2
valueA valueB
valueC valueD
This returns one row with null columns.
Select jt.*
From json_data,
json_table(myData, '$.[*]'
columns( key1, key2)) jt;
I can't seem to make the Oracle functions (json_table, json_query, json_value, ...) handle this without wrapping the array in an object.
{ "base":[ {"key1":"valueA", "key2":"valueB"}, {"key1":"valueC", "key2":"valueD"} ] }
Then this query works:
Select jt.*
From json_data,
json_table(myData, '$.base[*]'
columns( key1, key2)) jt;
Is there a shortcoming with the Oracle functions or what am I doing wrong?