I have searched quite much on this and still unanswerable. I\'m using PostgreSQL. Column name is \"sections\" and column type is json[] in below example.
My column looks
And also, if there was a key value map data in array
:
select each_data -> 'value' as value3
from t cross join jsonb_array_elements(t.sections -> 'attributes') each_attribute
where each_attribute -> 'key' = '"attrkey3"'
I am mentioning this because the great answer also provided a perfect solution for my case. By the way, also be aware of jsonb_array
.. method for jsonb
type attribute.