I have an object as follows:
{
"id": 1,
"dataLockVersion": 0,
"auditData": {
"createDate": "2018-09-18T11:41:28.362",
"createUser": "XXX",
"updateDate": null,
"updateUser": null
},
"property1": 14021,
"property2": {...},
"property3": "Obj"
}
And I have an array that contains multiple objects in that format.
I want to create a new array of objects from this array, which will contain objects in this format :
{
"property1": 14021,
"property2": {...},
"property3": "Obj"
}
This is what I tried :
var result = [];
for (i = 0; i < arr.length; i++) {
delete arr[i].auditData;
delete arr[i].dataLockVersion;
delete arr[i].domainObjectDescription;
delete arr[i].id;
result.push(arr[i]);
}
Is there a better way to do this ?
Innovativeway! you can check it too.