title: How to loop through a JSON object with typescript (Angular2)
body: <p>I am new to Angular2 and I am trying to loop through a JSON object that I am getting back from a GET request but can't work it out. </p>
  
  <p><strong>My JSON object:</strong></p>
  
  <pre><code>{
      Results: [{
          Time: "2017-02-11T08:15:01.000+00:00",
          Id: "data-mopdsjkajskda",
          AuthorId: "58fSDNJD"
      }, {
          Time: "2017-03-11T06:23:34.000+00:00",
          Id: "data-2371212hjb1",
          AuthorId: "43555HHHJ"
      }, {
          Time: "2017-04-11T07:05:11.000+00:00",
          Id: "data-kjskdha22112",
          AuthorId: "XDSJKJSDH"
      }]
  }
  </code></pre>
  
  <p><strong>Part of my Angular script:</strong></p>
  
  <pre><code>interface res {
      Time: string;
      Id: string;
      AuthorId: string;
  }
  export class AppComponent {
      results: res;
      constructor(private _httpservice: HTTPService) {}
      this._httpservice.getQuery().subscribe(
          data =&gt; {
              this.results = data.Results
          },
          error =&gt; console.log(error),
          () =&gt; console.log('Done')
      );
  }
  </code></pre>
  
  <p>I do get the data back - which is great. However, I want to push the Ids into an array. In Javascript I would do this: </p>
  
  <pre><code>var ids = [];
  
  for (i = 0; i &lt; data.Results.length; i++) {
      ids.push(data.Results[i].Id)
  }
  </code></pre>
  
  <p>The array after the push: </p>
  
  <pre><code>ids = ['data-mopdsjkajskda', 'data-2371212hjb1', 'data-kjskdha22112'];
  </code></pre>
  
  <p>I am struggling to find a way to achieve the same results with Angular2. Any help would be greatly appreciated!</p>