title: PostgreSQL: split jsonb array on multiple columns with filter on object
body: <p>An example will explain better the goal.</p>
  <p>Suppose I have a table with a jsonb column that is an array of objects:</p>
  <pre class="lang-json prettyprint-override"><code>[
    {&quot;value&quot;: &quot;1&quot;, &quot;fieldUsedToFilter&quot;: &quot;A&quot;}, 
    {&quot;value&quot;: &quot;5&quot;, &quot;fieldUsedToFilter&quot;: &quot;C&quot;}, 
    {&quot;value&quot;: &quot;3&quot;, &quot;fieldUsedToFilter&quot;: &quot;B&quot;}
  ]
  </code></pre>
  <p>What I want to do is query this column, keep only the object that contains the &quot;fieldUsedToFilter&quot; that is set to &quot;A&quot; or &quot;B&quot; and extract the value from the &quot;value&quot; field, i.e.:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>A</th>
  <th>B</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>As you can see I skipped the C object and keep the values from objects A and B onethe same row.</p>
  <p>P.S. the size of the array is unknown</p>