Here is an example of object array A:
[
{
"Timestamp": "2015-10-01 00:00:00",
"Label": "Voltage",
"Value": "230.12"
},
{
"Timestamp": "2015-10-01 00:00:00",
"Label": "Frequency",
"Value": "50.12"
},
{
"Timestamp": "2015-10-01 00:00:00",
"Label": "Power",
"Value": "23"
},
{
"Timestamp": "2015-10-02 22:22:22",
"Label": "Voltage",
"Value": "231.12"
},
{
"Timestamp": "2015-10-02 22:22:22",
"Label": "Frequency",
"Value": "51.12"
},
{
"Timestamp": "2015-10-02 22:22:22",
"Label": "Power",
"Value": "23.4"
}
]
I am looking to transform this into object array B like so:
[
{
"Timestamp": "2015-10-01 00:00:00",
"Voltage": "230.12",
"Frequency": "50.12",
"Power": "23"
},
{
"Timestamp": "2015-10-02 22:22:22",
"Voltage": "231.12",
"Frequency": "51.12",
"Power": "23.4"
}
]
I have tried looping through timestamps and then again through labels and values to create a new object array. However, with large amounts of data, this method becomes inefficient and crashes the browser. I would appreciate any suggestions on improving this process. Thank you.