I have JS object like this. The large numbers is presorted datetimes:
{
"param1" : [
[1607558636000, 937.85],
[1607561924000, 937.6],
[1607610353000, 939.02],
[1607610508000, 939.04],
],
"param2" : [
[1607558636000, 20.62],
[1607561924000, 16.35],
[1607610353000, 19.17],
[1607610608000, 22.01],
],
}
And want to make it look like this:
{
1607558636000 : {
"param1" : 937.85,
"param2" : 20.62
},
1607561924000 : {
"param1" : 937.6,
"param2" : 16.35
},
1607558636000 : {
"param1" : 937.85,
"param2" : 20.62
},
1607610508000 : {
"param1" : 939.04,
"param2" : null // no value for this parameter in this datetime
},
1607610608000 : {
"param1" : null, // no value for this parameter in this datetime
"param2" : 22.01
},
},
Cant figure out. Stuck all day with code in cycle in cycle in cycle, etc.......
param1andparam2, iterate over the set accessing each of the params from each of the original arrays, returning an object.}