psql: Parse JSON string
Postgresql supports querying fields in a json
or jsonb
field:
select json_column ->> 'field' as blah
If there is a json
string scalar that you need to parse as JSON, then we can roundtrip via jsonb
:
select (json_column::jsonb ->> 0)::json ->> 'field'
Published on: 13 Sep 2022