title: Rename the key name in json file using python
body: <p>I want to update a key name in my json file, the objects in the file look like: </p>
  
  <pre><code>[{"marka": "تويوتا" , "tag" : "MANF"},
  {"marka": "شيفروليه" , "tag" : "MANF"},
  {"marka": "نيسان" , "tag" : "MANF"}]
  </code></pre>
  
  <p>I want to change the key name "marka" into "entity", so it will be something like this: </p>
  
  <pre><code>[{"entity": "تويوتا" , "tag" : "MANF"},
   {"entity": "شيفروليه" , "tag" : "MANF"},
   {"entity": "نيسان" , "tag" : "MANF"}]
  </code></pre>
  
  <p>This is the code I've tried but it gives an error: </p>
  
  <pre><code>import json
  with open("haraj_marka_arabic.json", "r") as jsonFile:
       data = json.load(jsonFile)
  
  for d in data:
      d["entity"] = d.pop("marka")
  
  with open("haraj_marka_arabic.json", "w") as jsonFile:
      json.dump(data, jsonFile)
  </code></pre>
  
  <p>The error is: </p>
  
  <blockquote>
    <p>File "marka.py", line 8, in 
            d["entity"] = d.pop("marka")
        KeyError: 'marka'</p>
  </blockquote>