title: How to Parse a Json Data Response from an API call on Ionic as Below
body: <p>I made an api call and get a response as below, shown on console</p>
  
  <p>My Api Provider:</p>
  
  <pre><code>import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
  import { Injectable } from '@angular/core';
  import 'rxjs/add/operator/map';
  
  @Injectable()
  export class RestapiProvider {
  
  apiUrl = 'http://example.com/api/GetItemByCategory?cat_id=1&amp;merchant_id=1&amp;json=true';
  
    constructor(public http: HttpClient) {
      //console.log('Hello RestapiProvider Provider');
    }
  
  getItembyCategory() {
       return new Promise(resolve =&gt; {
          this.http.get(this.apiUrl).subscribe(data =&gt; {
        resolve(data);
        console.log(data);
      }, err =&gt; {
          console.log(err);
        });
      });
  }
  </code></pre>
  
  <p>Console.log(data) shows</p>
  
  <pre><code>[object Object]: {code: 1, details: Object, msg: "success..", request: "{"cat_id":"1","merchant_id":"1","json":"true"}"}
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/vEdso.jpg" rel="nofollow noreferrer">console.log(data)</a></p>
  
  <p>I need to parse the json data on '<strong><code>details: Object</code></strong>'</p>
  
  <p>I tried <strong><code>console.log(data.details)</code></strong> 
  got error:</p>
  
  <p><code>Unable to get property 'details' of undefined or null reference</code></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I was trying to use <code>map</code> operator as below</p>
  
  <pre><code>this.http.get(this.apiUrl).map(data =&gt; data.json()).subscribe(data =&gt; {
    resolve(data);
    console.log(data);
  }
  </code></pre>
  
  <p>Got another error: <code>property json does not exist on type 'Object'</code></p>
  
  <p>Please let me know how to make it work on ionic 3.</p>
  
  <p>Regards</p>
  
  <p><a href="https://i.stack.imgur.com/vEdso.jpg" rel="nofollow noreferrer">console.log SS</a></p>