title: Flatten JSON into Specific Format
body: <p>I'd like to use Java to take in a JSON body, iterate through the records, and output every other record into a new JSON array. Each set of two records will be its own array, and I only need to take the first one in each respective array. I'll also be providing the column names in the original request that need to be added to the subsequent flattened object. For example, let's say I have the following JSON request body:</p>
  
  <pre><code>{
    "records": [
      [
          [
              "0DFC29E2-700E-4CC1-931E-B61DF4954B6B",
              "John Doe",
              "Teacher",
              "China"
          ],
          [
              "B5B9186E-CE65-4911-8516-C510D3CC3ACE",
              "Jane Doe",
              "Doctor",
              "London"
          ]
      ],
      [
          [
              "20C4DD07-4E96-47F8-A1E1-B20B4C48120C",
              "Jim Doe",
              "Lawyer",
              "Canada"
          ],
          [
              "76718CB1-238F-418E-BD14-5E2867FF3FB4",
              "Jack Doe",
              "Chef",
              "Mexico"
          ]
       ]
     ],
      "columns": [
       "ID",
       "Name",
       "Occupation",
       "Location"
     ]
  }
  </code></pre>
  
  <p>I'd then like this request body flattened to the following:</p>
  
  <pre><code>[{
    "ID": "0DFC29E2-700E-4CC1-931E-B61DF4954B6B",
    "Name": "John Doe",
    "Occupation": "Teacher",
    "Location": "China"
  },
  {
    "ID": "20C4DD07-4E96-47F8-A1E1-B20B4C48120C",
    "Name": "Jim Doe",
    "Occupation": "Lawyer",
    "Location": "Canada"
  }]
  </code></pre>
  
  <p>I'd like this code to be pretty dynamic, so it doesn't explicitly reference the column names in code. That way I can pass up other column names in the future if I have a different JSON body structure, and it will work accordingly. I'll always be passing up the data with a title of "records" so that's okay to hardcode. Any help is greatly appreciated.</p>