given the following array of objects:
p =[
{
"object1": "value",
},
{
"object2": "value",
},
{
"object1": "value",
},
{
"object3": "value",
},
{
"object4": "value",
},
{
"object1": "value",
},
{
"object3": "value",
}
];
How would I modify the keys objects with the same key?
So that I have a new array like such:
p =[
{
"object1_1": "value",
},
{
"object2": "value",
},
{
"object1_2": "value",
},
{
"object3_1": "value",
},
{
"object4": "value",
},
{
"object1_3": "value",
},
{
"object3_2": "value",
}
];
I need to keep the structure of the array nearly identical --with just updates to the duplicate keys.
object4and notobject4_1?