title: How to recover data from a json object in typescript
body: <p>I'm trying to use values obtained from an API that return the values in JSON.</p>
  
  <p>I can see the values of the object in the console. But I can not use them apart.</p>
  
  <p>How do I assign values in different variables, separately?</p>
  
  <p>I want to validate the data before sending it to the HTML.</p>
  
  <blockquote>
    <p>IMG
    <a href="https://i.stack.imgur.com/WGdhM.png" rel="nofollow noreferrer">Values in the console</a></p>
  </blockquote>
  
  <pre><code>this.http
    .get(this.url + e)
    .map((res) =&gt; res.json())
    .subscribe((data) =&gt; this.user = data);
  </code></pre>
  
  <blockquote>
    <p>OR</p>
  </blockquote>
  
  <pre><code>getData() {
  let e = md5(this.userString);
  this.http
    .get(this.url + e)
    .map((res) =&gt; res.json())
    .subscribe(
    user =&gt; this.user = user,
    error =&gt; this.errorMessage = &lt;any&gt;)}
  </code></pre>
  
  <p>Thank You</p>