I have the following json:
{
"signedOffTasks":[
"TASK2"
],
"taskDeadlines":[
{
"taskKey":"TASK1",
"deadline":"2016-05-02"
},
{
"taskKey":"TASK2",
"deadline":"2016-05-02"
},
{
"taskKey":"TASK3",
"deadline":"2016-05-02"
},
{
"taskKey":"TASK4",
"deadline":"2016-05-02"
},
{
"taskKey":"TASK5",
"deadline":"2016-05-02"
},
{
"taskKey":"TASK6",
"deadline":"2020-05-18"
}
]
}
and the following json path expression:
$.taskDeadlines[?(@.deadline == "2020-05-18" && $.signedOffTasks.indexOf(@.taskKey) == -1)]
that is I want to return something where the deadline is 2020-05-18, and the appropriate task key is not in the signedOffTasks array.
This works very well in
https://codebeautify.org/jsonpath-tester
but unfortunately, if I use the same JSON in an Oracle 12c CLOB column, Oracle does not allow me to mix contexts. It has problems with the $ in the second predicate.
How can I express what I want with Oracle Json path implementation?
This is how I want to make the Oracle query:
SELECT
*
FROM
TABLE MY_TABLE T
WHERE
JSON_EXISTS ( T.JSON_COLUMN,'$.taskDeadlines[?(@.deadline == "2020-05-18" && $.signedOffTasks.indexOf(@.taskKey) == -1)]')
Thanks