title: How to map JSON response to Model in Angular 4
body: <p>I have tried a lot but I am not able to get endpoint response mapped to my model. I am using HttpClient and Angular4. 
  I got data back from service but it is not mapped correctly to my model class. </p>
  
  <p>I have following JSON which service is Returning: </p>
  
  <pre><code>{
      "result": [
          {
              "id": "1",
              "type": "User",
              "contactinfo": {
                  "zipcode": 1111,
                  "name": "username"
              }
          }
      ]
  }
  </code></pre>
  
  <p>I have created a model in typescript which I will like to map to json response: </p>
  
  <pre><code>export interface result {
              zipcode: number;
              name: string;
  }
  </code></pre>
  
  <p>This is how i call JSON endpoint. </p>
  
  <pre><code>result : string[] = [];
  
  constructor(private http: HttpClient) {    }
  
  public getList(): result[] {
          this.http.get&lt;result[]&gt;('url...', { headers: this.headers }).subscribe(
  
              data =&gt; {
               // 1. Data is returned - Working
                  console.log('data: ' + data); 
                  this.result= data;
  
                  // This is the problem. My data is not mapped to my model. If I do following a null is returned
                  console.log('data mapped: ' + this.result[0].name);
              },
              (err: HttpErrorResponse) =&gt; {
      // log error
              }
          );
  
          return this.result;
      }
  </code></pre>