I want to access and edit a **nested ** key in the object (not the value but the key itself).
eg;
{
"name": {
"firstname": "Boba",
"lastName": "Fett"
}
}
For example I want to edit the name.firstname field to FullName as shown below;
{
"name": {
"FullName": "Boba",
"lastName": "Fett"
}
}
Using lodash, tried unsetting the key value pair and setting a new pair with the key changed but this will add the new pair to the end of the json, i want to preserve the order of the json.
Also note that the key may be nested several levels deep and i have the path to the key. Are there any other libraries or other ways i can do this instead of using a recursive loop?
Im using JavaScript.
Thanks in advance:)