I need to read the json file data and separate the string
for example :
0: “AKERMI ## 1988” ===>
Name: akermi
Date: 1988
Use map(), it’s the best way to read input data in json, it will sort it out nicely automatically. I suggest you read / watch this JoshMorony’s tutorial for starters (most are available as free youtube streams too).
Even I have faced the similar issue. I took the following approach to access take strings out of it:
let data:Array;
service.getData().subscribe(res =>{
for ( var n in res.AKERMI)
{
data[n].Name = res.AKERMI[n].Name;
data[n].Date = res.AKERMI[n].Date;
}
})
I have subscribe to get the JSON string into the res then I am storing the result into the array.
Not like that
Here is my file
JSON file :
{
0: “AKERMI##1988”,
5: “AKIM DE DUCOR##2005”,
6: “AL FATIH##2003”,
9: “AMER##1984”,
13: “BELAMER##2004”,
15: “CHAHATA##1990”,
20: “CHARH##1999”,
23: “CHEIKH EL ARAB##1990”,
24: “DAHESS##1999”,
35: “DARIKE##1991”,
44: “DARMAN##1998”,
50: “DAYJUR##1991”,
51: “DJARNI DES FORGES##1995”,
55: “DJELMANE##1999”,
77: “DJOURDAN##1999”,
83: “DORMANE##1984”,
}