I am dealing with an array in Angular 14 that looks like this:
[
{
"parentItem": "WBP258R",
"childItem": "WBP258R",
"columnName": "Color",
"oldValue": "Rainbow",
"newValue": "Rainbow1"
},
{
"parentItem": "WBP258R",
"childItem": "WBP258R",
"columnName": "Pg #",
"oldValue": "4",
"newValue": "44"
},
{
"parentItem": "WBP258R",
"childItem": "WBP258R",
"columnName": "Status",
"oldValue": "New",
"newValue": "Rev"
}
]
I am seeking help to convert the data into a different format. I want to change the column values to be the property name, like this:
{
"parentItem": "WBP258R",
"childItem": "WBP258R",
"Color": "Rainbow",
"Color_newValue": "Rainbow1",
"Pg #": "4",
"Pg #"_newValue": "44",
"Status":"New",
"Status_newValue": "Rev",
}
If anyone can provide assistance, it would be greatly appreciated. Thank you in advance.