im trying to rename the keys of this array:
'oldname': [
       {"name": "cat", "category": "animal"}
       ,{"name": "dog", "category": "animal"}
       ,{"name": "pig", "category": "animal"}
           ],
 'oldname1': [
       {"name": "pikachu", "category": "pokemon"}
       ,{"name": "Arbok", "category": "pokemon"}
       ,{"name": "Eevee", "category": "pokemon"}
             ]
i tried with this code:
        const obj = {oldKey: Object.values(result)};
        delete Object.assign(results, {newname: obj.oldKey})['oldname'];
        console.log(result);
but I'm doing it wrong because we dont need to effect the value, it should be something like this:
  'newname': [
       {"name": "cat", "category": "animal"}
       ,{"name": "dog", "category": "animal"}
       ,{"name": "pig", "category": "animal"}
           ],
  'newname1': [
       {"name": "pikachu", "category": "pokemon"}
       ,{"name": "Arbok", "category": "pokemon"}
       ,{"name": "Eevee", "category": "pokemon"}
             ]
is there any better way to do it using javascript?
 
     
    