title: How to only keep properties from a Postgres jsonb object that exist in an array of keys?
body: <p>I have a <code>jsonb</code> 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.</p>
  
  <p>If my object is:</p>
  
  <pre><code>'{"foo": true, "bar": 2, "baz": "cat", "other": "Some text"}'::jsonb
  </code></pre>
  
  <p>and my array of properties to extract is <code>'{foo,other}'</code>, my desired result is:</p>
  
  <pre><code>'{"foo": true, "other": "Some text"}'::jsonb
  </code></pre>
  
  <p>How can I achieve this?</p>