title: Combining the elements of array and reformatting the output
body: <p>I am having an input JSON which I would like to transform using Mule's dataweave 2.0.</p>
  
  <p>Below is the input JSON.</p>
  
  <pre><code>[
     {
       "data1": {
                  "role": "analyst",
                  "name": "ABC"
       },
       "data2": {
                  "role": "analyst",
                  "name": "DEF"
       }
    },
    {
       "data1": {
                  "role": "RM",
                  "name": "PQRS"
       },
       "data2": {
                  "role": "analyst",
                  "name": "QWE"
       }
    }
  ]
  </code></pre>
  
  <p>We would like the output as below :</p>
  
  <pre><code>[
    {
       "role": "analyst",
       "name": "ABC"
    },
    {
       "role": "analyst",
       "name": "DEF"
    },
    {
       "role": "RM",
       "name": "PQRS"
    },
    {
       "role": "analyst",
       "name": "QWE"
    }
  ]
  </code></pre>
  
  <p>I have tried different options using map, pluck and flatten, but could not get the solution. Please help me with the transform function for this.</p>