Angular2: res.json is not a function
<p>I am trying to use the following service in my code:</p>

<pre><code>import {Injectable} from '@angular/core';
import {Http,Response} from "@angular/http";
import 'rxjs/Rx';

@Injectable()
export class HttpService{
    constructor(private http : Http){}

    getData(){
      return  this.http.get("URI")
      .map( (res: Response) =&gt; res.json()  );
    }
}
</code></pre>

<p>The problem is, in run time it complains with:</p>

<pre><code>res.json is not a function
</code></pre>

<p>I have defined the datatype of res as Response, but still complains</p>

<pre><code>.map( (res: Response) =&gt; res.json()  ) 
</code></pre>

<p>if i replace the map with subscribe it works fine:</p>

<pre><code>.subscribe( res =&gt;{
                res.json();
                console.log("City is:"+ res.json().city.name)
            });
</code></pre>