I would like to retrieve a speicific array element from a returned JSON request. So far I can get the whole feed, but I am struggling how to restrict it to a specific element.
So far I have this in my service controller;
getJsonData(){
return this.http.get('https://www.reddit.com/r/worldnews/.json').map(res => res.json());
}
In my page I have;
getdata() {
this.HttpModule.getJsonData().subscribe(
result => {
this.News= result.data.children(1);
console.log("success:"+this.News);
},
err => {
console.error("Error : "+err);
},
() => {
console.log("getData completed");
}
);
}
It should be children by I tried children(1) as a guess but it didn't work
JSON.Parseand then accessing children[1]?