I am trying to update the keys of a JSON object which looks like this:
results = 
 {  
   'Game':12345,
   'stats':[  
      {  
         'detail':[  
            {  
               'goals':4,
               'refs':{  
                  'number':0
I am currently manually updating each key as follow
##update Game to newValue
results['newValue'] = results['Game']
    del results['Game']
## update nested key "goals" to "goals_against"
results['stats'][0]['detail'][0]['goals_against'] = results['stats'][0]['detail'][0]['goals']
    del results['stats'][0]['detail'][0]['goals']
there has to be a better way to do as I am finding myself having to update multiple keys on results. For example, I also want to update the "number" key to "assis_ref".
I know how to update a key if is the json file is "simple": ie if i could do this:
result['stats']['details']['refs']
however, 'stats' and 'details' require [0] next to it which i assume is the index of the element i am trying to go next.
 
     
    