Is it possible to convert an interface class and JSON file into a list or array in order to work on it? For example, extracting the Racename
from each object in the JSON file and storing it in a list/array. Here is the interface structure:
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 content of 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"}
]
The subscription process looks like this:
this.runnerService.getRunners().subscribe(
runners=>{
this.runners = runners;
this.filteredCompetitions = this.runners;
this.filteredRunners = this.runners;
}
I want to transform the JSON data stored in runners
into an array so that I can manipulate it and extract necessary information. As a newcomer to Typescript and Angular, I may be making some mistakes.