PostgreSQL
 sql >> Base de Dados >  >> RDS >> PostgreSQL

Executar consulta com base no JSON armazenado dentro da coluna


Use ->> operador :
-- Example data
create table test (id int, js jsonb);
insert into test values 
(1, '{"a":"1","b":"2","c":"3"}'),
(2, '{"a":"1","b":"2","c":"4"}');

--query
select * 
from test
where js->>'c' = '3';

 id |               js               
----+--------------------------------
  1 | {"a": "1", "b": "2", "c": "3"}
(1 row)