Q:

How do I select all rows that have a particular key in a JSON field?

I want to select all rows in a table where my "object_details" JSON field contains one of the following keys: "subject", "Subject", "SUBJECT". 
With the following sample rows:
datetime             | object_details                                             
---------------------+------------------------------------------------------------
2019-07-21T00:01:34Z | {"Sender": "bob@example.com", "Subject": "First email!"}   
2019-07-23T09:30:01Z | {"Sender": "carol@example.com", "subject": "Second email!"}
2019-07-27T22:23:15Z | {"Sender": "dave@example.com", "protocol": "SMTP"}         

I'm expecting the result to provide only these rows:
datetime             | object_details                                             
---------------------+------------------------------------------------------------
2019-07-21T00:01:34Z | {"Sender": "bob@example.com", "Subject": "First email!"}   
2019-07-23T09:30:01Z | {"Sender": "carol@example.com", "subject": "Second email!"}

A:

You can use the exists operator ?|  that takes an array of keys as its input for that:
select *
from the_table
where object_details ?| array['subject', 'Subject', 'SUBJECT'];

