I am trying to figure out a way to change the index of an object which has some other objects also with keys. suppose I want to pass key to a function as 3(C) then I want to find a key in an object which is same as 3(C) and make its index as 0
I tried to use hasOwnProperty but it always gives me only true when I pass 3(C). I tried most of the things but it fails in case of nested arrays
{
"1(C)": {
"STORE (06:00 )": [
{
"personId": "---",
"scheduledEventId": "----",
"employeeName": "----.",
"phoneNumber": "-----",
"ranking": "-----",
"perAph": "----",
"distPerAph": "--",
"distanceToEvent": "0"
}
]
},
"3(C)": {
"THUdx (06:00 )": [
{
"personId": "---",
"scheduledEventId": "----",
"employeeName": "----.",
"phoneNumber": "-----",
"ranking": "-----",
"perAph": "----",
"distPerAph": "--",
"distanceToEvent": "0"
}
]
}
}
The expected result should have 3(C) object at index 0
{
"3(C)": {
"THUdx (06:00 )": [
{
"personId": "---",
"scheduledEventId": "----",
"employeeName": "----.",
"phoneNumber": "-----",
"ranking": "-----",
"perAph": "----",
"distPerAph": "--",
"distanceToEvent": "0"
}
]
},
"1(C)": {
"STORE (06:00 )": [
{
"personId": "---",
"scheduledEventId": "----",
"employeeName": "----.",
"phoneNumber": "-----",
"ranking": "-----",
"perAph": "----",
"distPerAph": "--",
"distanceToEvent": "0"
}
]
}
}