In the data below. I would like to get it an object with some of the values as keys , like this:
FROM HERE: link to the whole data HERE (this.localObject)
const employees = [{
"EmployeeID": "100A",
"FirstName": "Downs",
"aval": [
{"start": "11-19", "end": "2", "ava": "30", "health": "4"},
{"start": "11-20", "end": "2", "ava": "40", "health": "4"},
{"start": "11-21", "end": "2", "ava": "50", "health": "4"},
{"start": "11-22", "end": "2", "ava": "60", "health": "4"}
]
},
{
"EmployeeID": "100B",
"FirstName": "Mckenzie",
"aval": [
{"start": "11-19", "end": "2", "ava": "1", "health": "4"},
{"start": "11-20", "end": "2", "ava": "2", "health": "4"},
{"start": "11-21", "end": "2", "ava": "3", "health": "4"},
{"start": "11-22", "end": "2", "ava": "4", "health": "4"}
]
},
]
TO HERE:
const employees = [
{ "EmployeeID": "100A", "11-19": "30"},
{ "EmployeeID": "100A", "11-20": "40"},
{ "EmployeeID": "100A", "11-21": "50"},
{ "EmployeeID": "100A", "11-22": "60"},
{ "EmployeeID": "100B", "11-19": "1"},
{ "EmployeeID": "100B", "11-20": "2"},
{ "EmployeeID": "100B", "11-21": "3"},
{ "EmployeeID": "100B", "11-22": "4"}
]
//and so on...
So far I've tried:
this.localData = this.localObject.employees;
const firstLevel = this.localData.map(x => x.aval);
firsLevel will give me an array of objects which is closer to what I need, now I need to put the "start" value as a key and the "ava" value as a value property inside their own object containers