RxJS: JSON data with an array, processing each item further in the stream
问题 I receive a HTTP response, which contains, if all goes well, a single array, coded as JSON. I want to get this array, filter out some items, and process the passing items as events. What I do so far is: return this._http.get(url) .map((res:Response) => res.json()) .map((data:any) => { if (!Array.isArray(data) || data.length == 0) { throw new Error("No items returned, URL: " + url); } let projects = <ProjectModel[]>service.fromJSONarray(data, this._http); return Observable.from(projects)