title: Parsing json in angular2
body: <p>I am trying to read the count of users in my angular2 application from services.
  We have a swagger generate the stub from the service. </p>
  
  <p>My stub (gpMapApi):</p>
  
  <pre><code> public findMapByIdsUsingGET(oId?: number, id?: number, extraHttpRequestParams?: any): Observable&lt;string&gt; {
          return this.findMapByIdsUsingGET(oId, id, extraHttpRequestParams)
              .map((response: Response) =&gt; {
                  if (response.status === 204) {
                      return undefined;
                  } else {
                      return response.json();
                  }
              });
      }
  </code></pre>
  
  <p>My Json response:</p>
  
  <pre><code>{"count" : 0}
  </code></pre>
  
  <p>My Typescript </p>
  
  <pre><code>public checkUserExist(oId,Id) {
         this.gpMapApi.findMapByIdsUsingGET(oId,id)
               .subscribe(response =&gt; {
                    if ((&lt;any&gt;response) !== null &amp;&amp; (&lt;any&gt;response)['_body'] !== null &amp;&amp; (&lt;any&gt;response)['_body']['count'] !== null) {
                  this.iCount = (&lt;any&gt;response)['_body']['count'];
          });      
      }
  </code></pre>
  
  <p>But I get error saying "count" is undefined.
  Error  message from chrome</p>
  
  <pre><code>"Cannot read property 'count' of undefined"
  </code></pre>
  
  <p>how to read the json response. </p>
  
  <p>Solution 
  Used 
   JSON.parse((response)._body).count</p>