title: Postgresql select json array into rows and single text
body: <p>I have query to get result from table like this:</p>
  
  <pre><code>SELECT  test_id, content::json-&gt;'scenario'
  FROM    test
  </code></pre>
  
  <p>And i got these result, with array of objects in the scenario column:</p>
  
  <pre><code>test_id | scenario
  29      | [{"name":"OpenSignal", "task":[{"name":"speedtest"}]}, {"name":"ITest", "task":[{"name":"speedtest"}]}, {"name":"EqualOne", "task":[{"name":"flashtest"}, {"name":"web"}, {"name":"video"}]}]
  30      | [{"name":"Speedtest", "task":[{"name":"speedtest"}]}, {"name":"ITest", "task":[{"name":"speedtest"}]}, {"name":"EqualOne", "task":[{"name":"flashtest"}, {"name":"web"}, {"name":"video"}]}]
  </code></pre>
  
  <p>The object structure is like this:</p>
  
  <pre><code>[{
      "name": "OpenSignal",
      "task": [{
          "name": "speedtest"
      }]
  }, {
      "name": "ITest",
      "task": [{
          "name": "speedtest"
      }]
  }, {
      "name": "EqualOne",
      "task": [{
          "name": "flashtest"
      }, {
          "name": "web"
      }, {
          "name": "video"
      }]
  }]
  </code></pre>
  
  <p>How can i get result like these:</p>
  
  <pre><code>test_id | scenario
  29      | Opensignal-speedtest
  29      | ITest-speedtest
  29      | EqualOne-flashtest
  29      | EqualOne-web
  29      | EqualOne-video
  30      | Opensignal-speedtest
  30      | ITest-speedtest
  30      | EqualOne-flashtest
  30      | EqualOne-web
  30      | EqualOne-video
  </code></pre>
  
  <p>And</p>
  
  <pre><code>test_id | scenarios
  29      | OpenSignal-speedtest,ITest-speedtest,EqualOne-flashtest, EqualOne-web,EqualOne-video
  30      | Speedtest-speedtest,ITest-speedtest,EqualOne-flashtest,EqualOne-web,EqualOne-video
  </code></pre>
  
  <p>Thanks in advance my brothers</p>