I have a jsonb object with numerous properties, and I have a Postgres array of keys that I want to extract from the object, into a new, stripped-down object.
If my object is:
'{"foo": true, "bar": 2, "baz": "cat", "other": "Some text"}'::jsonb
and my array of properties to extract is '{foo,other}', my desired result is:
'{"foo": true, "other": "Some text"}'::jsonb
How can I achieve this?