title: Mapping Observable to array of objects
body: <p>I have rest api which is returning me json array with data.
  On client side I use this code to create objects from request.</p>
  
  <pre><code>public getNews(): Observable&lt;News[]&gt; {
  
  return this.http.get(this.baseUrl + '/news')
    .pipe(
      catchError(this.handleError('getNews', []))
    )
    .map(res =&gt; {
      let response: any = res;
      return response.map((item) =&gt; new News(item));
    });
  }
  </code></pre>
  
  <p>Subscribing:</p>
  
  <pre><code>this.restProvider.getNews().subscribe((news: News[]) =&gt; {
    this.news = news;
  });
  </code></pre>
  
  <p>But how can I resolve issue when response is not an array but only single element? Or response is wrong like for example unexpected data from API?</p>
  
  <p>Currently in those situations my application is throwing this error:</p>
  
  <blockquote>
    <p>response.map is not a function</p>
  </blockquote>