How do I rename Object name from Cars to automobiles? I tried using ObjectRenameKeys but it works on the properties within objects not the object name itself.
Original:
"Cars": [
{
"Part": 1
},
{
"Part": 2
},
{
"Part": 3
}
],
Expected:
"Automobiles": [
{
"Part": 1
},
{
"Part": 2
},
{
"Part": 3
}
],
You can't really rename properties....just copy Cars and then delete it:
myObject.Automobiles = myObject.Cars;
delete myObject.Cars;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.