title: Analysing and formatting JSON using PostgreSQL
body: <p>I have a table called api_details where i dump the below JSON value into the JSON column raw_data.
  Now i need to make a report from this JSON string and the <strong>expected output</strong> is something like below,</p>
  <pre><code>action_name.              sent_timestamp                           Sent. Delivered
  campaign_2475             1600416865.928737 - 1601788183.440805.    7504. 7483
  campaign_d_1084_SUN15_ex  1604220248.153903 - 1604222469.087918.   63095. 62961
  </code></pre>
  <p><strong>Below is the sample JSON OUTPUT</strong></p>
  <pre><code>{
    &quot;header&quot;: [
      &quot;#0 action_name&quot;,
      &quot;#1 sent_timestamp&quot;,
      &quot;#0 Sent&quot;,
      &quot;#1 Delivered&quot;
      
    ],
    &quot;name&quot;: &quot;campaign - lifetime&quot;,
    &quot;rows&quot;: [
      [
        &quot;campaign_2475&quot;,
        &quot;1600416865.928737 - 1601788183.440805&quot;,
        7504,
        7483
      ],
      [
        &quot;campaign_d_1084_SUN15_ex&quot;,
        &quot;1604220248.153903 - 1604222469.087918&quot;,
        63095,
        62961
      ],
      [
        &quot;campaign_SUN15&quot;,
        &quot;1604222469.148829 - 1604411016.029794&quot;,
        63303,
        63211 
      ]
    ],
    &quot;success&quot;: true
  }
  </code></pre>
  <p>I tried like below, but is not getting the results.I can do it using python by lopping through all the elements in row list.</p>
  <p><strong>But is there an easy solution in PostgreSQL(version 11).</strong></p>
  <pre><code>SELECT raw_data-&gt;'rows'-&gt;0 
    FROM api_details
  </code></pre>