Using PostgreSQL 9.5.5 Given the below example jsonb data in a column:
{
"item_id": "123456",
"action_information_1": [ {"value": "259", "action_type": "read"} ],
"action_information_2": [ {"value": "93", "action_type": "read"} ],
"action_information_3": [ {"value": "53", "action_type": "read"} ],
"action_information_4": [ {"value": "35", "action_type": "read"} ]
}
I'm having difficulty programmatically extracting the 'value' from 'action_information_1' which would be 259.
It seems the syntax is slightly different from other examples I've seen, the above has preceding ' " ' in front of the ' [ '.
Any help is appreciated, thank you
"
around keys and values not'
and the array[...]
must not be enclosed in double quotes. – a_horse_with_no_name Jan 19 at 15:22col->'action_information_1'->0->>'value'
, if you need array index parametrizedjsonb_extract_path(col->'action_information_1',?)->>'value'
– cske Jan 19 at 15:27