title: Transpose JSON array index column values into rows & export to CSV
body: <p>I have a JSON file with below format:</p>
  
  <pre class="lang-json prettyprint-override"><code>[
          {
              "id":  "12345",
              "name": "test_group",
              "members":  
                  [
                      {
                          "id":  "11111",
                          "name": "test_member_1"
                      },
                      {
                          "id":  "22222",
                          "name": "test_member_2"
                      },
                      {
                          "id":  "33333",
                          "name": "test_member_3"
                      }
                  ]
          }
  ]
  </code></pre>
  
  <p>My requirement is to convert these into below format/output to CSV:</p>
  
  <pre>
  groupId,groupName,memberId,memberName
  12345,test_group,11111,test_member_1
  12345,test_group,22222,test_member_2
  12345,test_group,33333,test_member_3
  </pre>
  
  <p>I am able to get the array index values as concatenated strings in one column using below code, but need the output in above format only:</p>
  
  <pre><code>$jsonfile = 'C:\newjsonfile.json'
  $outputcsv = 'C:\newcsvfile.csv'
  $fields=@(
       @{Name='groupId';Expression={$_.id}}
      ,@{Name='groupName';Expression={$_.name}}
      ,@{Name='memberId';Expression={$_.members.id, -join '|~|'}}
      ,@{Name='memberName';Expression={$_.members.name -join '|~|'}}
  )
  (Get-Content $jsonfile -Raw | ConvertFrom-Json) |
      Select-Object -Property $fields |
      Export-Csv $outputcsv -NoTypeInformation -Force
  </code></pre>
  
  <p>CSV Output from above query:</p>
  
  <pre>
  groupId, groupName,  memberId,              memberName                                   
  ----- ---------  --------              ----------                                   
  12345, test_group, {11111 |~| 22222 |~| 33333}, {test_member_1 |~| test_member_2 |~| test_member_3}
  </pre>
  
  <p>Please help/suggest in resolving this query in PowerShell.
  Current version is:</p>
  
  <pre>
  PS C:\WINDOWS\system32> $PSVersionTable.PSVersion
  
  Major  Minor  Build  Revision
  -----  -----  -----  --------
  5      1      17134  407   
  </pre>