I have a column x with data type jsonb
and the value looks like:
[
[{"string":"whateverstring1"}],
[{"string":"whateverstring2"}]
]
How to return each element of the array?
Something like this: "whateverstring1","whateverstring2"
SELECT jsonb_array_elements(jsonb) -> 0 -> 'string'
FROM (
SELECT '[[{"string":"whateverstring1"}],[{"string":"whateverstring2"}]]'::jsonb
) s
jsonb_array_elements extract each element into one row-> 0 gives the first element of the nested arrays which is {"string":"whateverstring1"}-> 'string' gives the value of the elements