RxJS: JSON data with an array, processing each item further in the stream
<p>I receive a HTTP response, which contains, if all goes well, a single array, coded as JSON.<br>
I want to get this array, filter out some items, and process the passing items as events.</p>

<p>What I do so far is:</p>

<pre><code>    return this._http.get(url)
        .map((res:Response) =&gt; res.json())
        .map((data:any) =&gt; {
            if (!Array.isArray(data) || data.length == 0) {
                throw new Error("No items returned, URL: " + url);
            }
            let projects = &lt;ProjectModel[]&gt;service.fromJSONarray(data, this._http);
            return Observable.from(projects)
                .filter((project: ProjectModel) =&gt; project.parentProject == null)
                .subscribe(project -&gt; ...)
        })
</code></pre>

<p>However I don't like the nesting. I assume there's a way to do this:</p>

<pre><code>    return this._http.get(url)
        .map((res:Response) =&gt; res.json())
        .map((data:any) =&gt; {
            ...
            let projects = &lt;ProjectModel[]&gt;service.fromJSONarray(data, this._http);
            ???
        })
        .filter((project: ProjectModel) =&gt; project.parentProject == null)
        .subscribe(project -&gt; ...)
</code></pre>

<p>How to achieve that?</p>