How do you check if a json field in Postgres has a certain element?
I have tried with json->>'attribute' is not null and doesn't work.
use ->:
where (json->'attribute') is not null 
                        While this works. It is better to use special operator ?:
WHERE your_column_name::jsonb ? 'attribute'   NOTE: Only for jsonb type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With