I have an array of objects and I need to rename the keys.
This is my approach:
Convert array of objects to JSON, replace the key and then do a JSON.parse
Replacing the oldKey with newKey is failing as this is a array!
Here is my JSON string.
str "[{\"194240_0900217\":\"500\"},{\"194242_0900294\":\"600\"}]"
I need like this:
str "[{\"194240\":\"500\"},{\"194242\":\"600\"}]"
Is there any other better approach to achieve this?