assuming I have json column which look something like:
-- first row:
{
"a": {
"x": {"name": "ben", "success": true},
"y": {"name": "sarah", "success": true},
"z": {"name": "john", "success": false}
}
}
-- second row:
{
"a": {
"m": {"name": "issac", "success": true},
"n": {"name": "jack", "success": true},
}
}
I want to select all rows which any of their a.<something>.success is not true.
in my Example - first row will be selected, second row will be filtered.
As you can see all jsons start with common key a, but under it there are unknown number of "childs" with unknown names ('x', 'y', 'z', 'm', 'n').
under each child with unknown name - there is a common known key I'd like to filter by: success.
Question is how Can filter such rows?
I got to something I could not complete:
SELECT * FROM my_table WHERE json_col::json -> 'a' -> <don't know what to put here> -> 'success' = true