I have an interface class and JSON file which I would like to convert to a list and work on it. for instance , getting Racename
from every object in the JSON into a list\array.
is it possible?
that's the interface:
interface IRunners{
Racename: string;
Category:number;
Gender:string;
Work:string;
FullName:string;
Rank:number;
Point:number;
Numparticipant:number;
rankparticipant:number;
precentagePart:string;
NumRaces:number;
RaceTime:string;
rankCat:number;
PointCat:number;
RaceDate:string;
}
This is the JSON file (Runners.json
):
[
{"Racename":"A1","Category":34,"Gender":"זכר","Work":"AMDOCS","FullName":"Simon Work ","Rank":1,"Ponit":1,"Numparticipant":0,"rankparticipant":0,"precentagePart":"0","NumRaces":1,"RaceTime":"2018-10-18T00:34:20","rankCat":1,"PointCat":1,"RaceDate":"2018-10-05"}
]
I'm subscribing it as follow:
this.runnerService.getRunners().subscribe(
runners=>{
this.runners = runners;
this.filteredCompetitions = this.runners;
this.filteredRunners = this.runners;
}
I would like to convert the runners
JSON into an array in order to make some changes and get some data out of it.
I'm a newbie to Typescript and Angular so probably I'm making some mistakes.