title: Parsing JSON in Python: how do I get has_key() working again after a change of format?
body: <p>I have the following block of Python code:</p>
  
  <pre><code>data = json.loads(line)
  if data.has_key('derivedFrom'):
       dFin = data['derivedFrom']
       if dFin.has_key('derivedIds'):
  </code></pre>
  
  <p>This used to work fine on a block of JSON like this:</p>
  
  <pre><code>"derivedFrom": {"source": "FOO", "model": "BAR", "derivedIds": ["123456"]}
  </code></pre>
  
  <p>Now the format changed to:</p>
  
  <pre><code>"derivedFrom": "{\"source\": \"FOO.\", \"model\": \"BAR\", \"derivedIds\": [\"123456\"]
  </code></pre>
  
  <p>And so the last line in the Python block throws the following exception:</p>
  
  <pre><code>'unicode' object has no attribute 'has_key'
  </code></pre>
  
  <p>Is there a way to preprocess JSON to make <code>has_key</code> work again?</p>