title: How to map key and values in typescript?
body: <p>I have the following response that I need to map into a useable format in typescript, </p>
  
  <pre><code>response =&gt; {
  
      Vehicles:
          BMW: Array(3)
              0: {ModelName: "M3", ModelUid: "14711"}
              1: {ModelName: "X3", ModelUid: "14712"}
              2: {ModelName: "Z4", ModelUid: "14713"}
  
          Aston Martin: Array(4)
              0: {ModelName: "DBS", ModelUid: "14742"}
              1: {ModelName: "DB9", ModelUid: "14743"}
              2: {ModelName: "V12 Vantage", ModelUid: "14744"}
              3: {ModelName: "Virage", ModelUid: "14745"}
  </code></pre>
  
  <p>I've done the below which works, but I think there must be a nicer way.</p>
  
  <pre><code>var vehicles = new Array();
  
  var keys = Object.keys(response.Vehicles);
  
  keys.forEach(key =&gt; {
      vehicles.push({ Manufacturer: key, Models: [] });
  });
  
  for (var i = 0; i &lt; vehicles.length; i++)
  {
      var name = vehicles[i].Manufacturer;
      vehicles[i].Models = response.Vehicles[name];
  }
  </code></pre>
  
  <p>Any help appreciated.</p>
  
  <p>Thanks</p>