title: Transform JSON map to an array in Postgres via update statement
body: <p>I have a postgresql table called <code>datasource</code> with jsonb column called <code>data</code>. It has the following structure:</p>
  <pre><code>{  
     &quot;key1&quot;:{&quot;param1&quot; : &quot;value1&quot;, &quot;param2&quot; : &quot;value2&quot;},
     &quot;key2&quot;:{&quot;param2_1&quot; : &quot;value2_1&quot;, &quot;param2_2&quot; : &quot;value2_2&quot;},
     &quot;key3&quot;:{&quot;param3_1&quot; : &quot;value3_1&quot;, &quot;param3_2&quot; : &quot;value3_2&quot;}  
  }
  </code></pre>
  <p>Is there any way to write some UPDATE script to transform given JSON to the following:</p>
  <pre><code>[  
     {&quot;key&quot;: &quot;key1&quot;, &quot;param1&quot; : &quot;value1&quot;, &quot;param2&quot; : &quot;value2&quot;},
     {&quot;key&quot;: &quot;key2&quot;, &quot;param2_1&quot; : &quot;value2_1&quot;, &quot;param2_2&quot; : &quot;value2_2&quot;},
     {&quot;key&quot;: &quot;key3&quot;, &quot;param3_1&quot; : &quot;value3_1&quot;, &quot;param3_2&quot; : &quot;value3_2&quot;}  
  ]
  </code></pre>