I have the following data being returned from my controller:
[
{
"date": "2019-12-06",
"weekday": "Friday",
"users": 2
},
{
"date": "2019-12-07",
"weekday": "Saturday",
"users": 1
},
{
"date": "2019-12-08",
"weekday": "Sunday",
"users": 1
},
{
"date": "2019-12-09",
"weekday": "Monday",
"users": 1
},
{
"date": "2019-12-10",
"weekday": "Tuesday",
"users": 1
},
{
"date": "2019-12-11",
"weekday": "Wednesday",
"users": 2
}
]
I want to return this instead:
{
"Sunday": 1,
"Monday": 1,
"Tuesday": 1,
"Wednesday": 2,
"Thursday": 0,
"Friday": 2,
"Saturday": 1
}
Where the numbers in the object are the "users" in the previous array, how would I go about this please?
