Använd operatorn ->>
(Hämta JSON-objektfält som text)
, t.ex.
with my_table(id, json) as (
values
(1, '{"key":95}'::json),
(2, '{"key":90}'),
(3, '{"key":50}')
)
select *
from my_table
where (json->>'key')::int >= 90;
id | json
----+------------
1 | {"key":95}
2 | {"key":90}
(2 rows)