title: Pivot JSON then create an Array from Array of Arrays,
body: <p>I'm having difficulty generating a table in Angular2 from JSON because I want to pivot the JSON data and cant build an interface for it (the method i normally use)</p>
  
  <p>An extract of the JSON im using is below which I convert which </p>
  
  <pre><code>[
    {
      "ValueDate": "2017-04-26T14:16:00",
      "AccountName": "CASHAUD",
      "Holding": 318622.53
    },
    {
      "ValueDate": "2017-04-26T14:16:00",
      "AccountName": "CASHCAD",
      "Holding": 7195
    },
    {
      "ValueDate": "2017-04-26T14:16:00",
      "AccountName": "CASHEUR",
      "Holding": 5077.97
    },
    {
      "ValueDate": "2017-04-26T14:16:00",
      "AccountName": "CASHGBP",
      "Holding": 19625
    },
    {
      "ValueDate": "2017-04-26T14:16:00",
      "AccountName": "CASHJPY",
      "Holding": 16463
    },
    {
      "ValueDate": "2017-04-26T14:16:00",
      "AccountName": "CASHNZD",
      "Holding": 601.56
    },
    {
      "ValueDate": "2017-04-26T14:16:00",
      "AccountName": "CASHSGD",
      "Holding": 1000
    },
    {
      "ValueDate": "2017-04-26T14:16:00",
      "AccountName": "CASHUSD",
      "Holding": 1716906.25
    },
    {
      "ValueDate": "2017-04-27T14:16:00",
      "AccountName": "CASHAUD",
      "Holding": 318622.53
    },
    {
      "ValueDate": "2017-04-27T14:16:00",
      "AccountName": "CASHCAD",
      "Holding": 7195
    },
    {
      "ValueDate": "2017-04-27T14:16:00",
      "AccountName": "CASHEUR",
      "Holding": 5077.97
    },
    {
      "ValueDate": "2017-04-27T14:16:00",
      "AccountName": "CASHGBP",
      "Holding": 19625
    },
    {
      "ValueDate": "2017-04-27T14:16:00",
      "AccountName": "CASHJPY",
      "Holding": 16463
    },
    {
      "ValueDate": "2017-04-27T14:16:00",
      "AccountName": "CASHNZD",
      "Holding": 601.56
    },
    {
      "ValueDate": "2017-04-27T14:16:00",
      "AccountName": "CASHSGD",
      "Holding": 1000
    },
    {
      "ValueDate": "2017-04-27T14:16:00",
      "AccountName": "CASHUSD",
      "Holding": 1720781.25
    }
  ]
  </code></pre>
  
  <p>I used the following tutorial <a href="http://techbrij.com/convert-column-to-row-javascript-array-pivot" rel="nofollow noreferrer">http://techbrij.com/convert-column-to-row-javascript-array-pivot</a> to pivot the JSON array which results in an array of arrays </p>
  
  <p><a href="https://i.stack.imgur.com/qx7zt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qx7zt.png" alt="enter image description here"></a> </p>
  
  <p>its not a bad result</p>
  
  <p>headings are always at <code>[i][0]</code>
  data is always at <code>[i + 1][j]</code></p>
  
  <p>Are there any ideas on a way I could loop through theses arrays to now create an object or another array which i could build a table from please?</p>