title: Python, delete JSON element having specific key from a loop
body: <p>Using Python, I need to delete all objects in JSON array that have specific value of 'name' key. However, I can't do that from a loop.</p>
  
  <p>Imaging I want to delete all items having 'bad' as name in the following input:</p>
  
  <pre><code>{
    'myArray' : [
      {
        'name' : 'good',
        'value' : '1'
      },
      {
        'name' : 'bad',
        'value' : '2'
      }
    ]
  }
  </code></pre>
  
  <p>So I use the following Python test case:</p>
  
  <pre><code>myData = {'myArray': [{'name': 'good', 'value': '1'}, {'name': 'bad', 'value': '2'}]}
  
  for a in myData['myArray']:
    if (a['name'] =='bad'):
      del a
  
  print(json.dumps(myData))
  </code></pre>
  
  <p>And I see that the myData is not changed.</p>
  
  <p>I assume this is because I try to delete an iterator of a loop, that might be considered as risky action by interpreter, however no runtime error or warning is reported by Python.</p>
  
  <p>What's the recommended approach in this case?</p>
  
  <p>Thanks!</p>