So im working with an array of objects that requires data from multiple objects to be put into one dependant on the date within those objects.
The starting object looks like this:
[
{
"LOCATION":17,
"Stock_In_Area":39.0709838867,
"DATE_DT":"2021-03-07",
},
{
"LOCATION":17,
"Stock_In_Area":41.8843955994,
"DATE_DT":"2021-03-14",
},
{
"LOCATION":612,
"Stock_In_Area":8.4867076874,
"DATE_DT":"2021-03-07",
},
{
"LOCATION":612,
"Stock_In_Area":9.2035646439,
"DATE_DT":"2021-03-14",
},
];
and im trying to get something like this:
{
"17":39.0709838867,
"612":8.4867076874,
"date":"2021-03-07",
},
{
"17":41.8843955994,
"612":9.2035646439,
"date":2021-03-14
},
So the object would be
{
[location]: stock_in_area
date: DATE_DT
}
where the two locations have the same date value