I need to transform an array into a different format based on the values of the ID
and class
properties.
Here is the initial array:
const json = [{
"ID": 10,
"Sum": 860,
"class": "K",
}, {
"ID": 10,
"Sum": 760,
"class": "one",
}, {
"ID": 10,
"Sum": 860,
"class": "two",
}];
The desired output should look like this:
[{"ID":10,"K":860,"one":760,"two":860}]