title: Creating XML out of JSON array in PostgreSQL
body: <p>I have a table with a column containing data like this: array of n json elements</p>
  
  <pre><code>[
    {"ref":"3455","desc":"My Product 1","price":"4","quant":"90"},
    {"ref":"3455","desc":"My Product 2","price":"5","quant":"80"}
  ]
  </code></pre>
  
  <p>I need to parse/iterate each of JSON element. In the example I have 2. The result will be a custom string (actually XML string).</p>
  
  <p>XML result expected:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;items&gt;
    &lt;item&gt;
      &lt;ref&gt;3455&lt;/ref&gt;
      &lt;desc&gt;My Product 1&lt;/desc&gt;
      &lt;price&gt;4&lt;/price&gt;
      &lt;quant&gt;90&lt;/quant&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;ref&gt;3455&lt;/ref&gt;
      &lt;desc&gt;My Product 2&lt;/desc&gt;
      &lt;price&gt;5&lt;/price&gt;
      &lt;quant&gt;80&lt;/quant&gt;
    &lt;/item&gt;
  &lt;/items&gt;
  </code></pre>
  
  <p>What is the best way to achieve this?</p>
  
  <p>thank you!</p>