title: Query last element in array from json structure in postgres
body: <p>Let's say that we have the following</p>
  
  <pre class="lang-js prettyprint-override"><code>{ "items" :
      [
          {"id": 1},
          {"id": 2},
          {"id": 3}
      ]
  }
  </code></pre>
  
  <p>How can I get the last element from the array in the given json structure? Getting the first one seems not that complicated</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT t.column-&gt;'items'-&gt;0 AS elem
  FROM   tbl t
  WHERE  other_column = 20;
  </code></pre>
  
  <p>Thanks in advance!</p>