title: In place editing of Python dictionary or parsing json to object
body: <p>I am by no means a Python Guru, but I know my way around. For the past two hours however I've been banging my head against the following:</p>
  
  <p>I am parsing a JSON response from a WCF Webservice using the json.loads() function. The result is a Python dictionary which I am using throughout my application. However, I now have the need to obfuscate the id, reseller_id etc. for use in HTTP GET requests.</p>
  
  <p>This is <strong>an</strong> example of <strong>a</strong> response: (note, I have many of these responses, so I am looking for a generic solution.) <strong>I want to replace the value of any id with a hash of the id value</strong></p>
  
  <pre><code>{
      "token":"String content",
      "user":{
          "distributor":{
              "email":"String content",
              "id":2147483647,
              "name":"String content"
          },
          "email":"String content",
          "first_name":"String content",
          "id":2147483647,
          "last_name":"String content",
          "reseller":{
              "email":"String content",
              "id":2147483647,
              "name":"String content",
              "portal_css":"String content",
              "portal_logo":"String content",
              "portal_name":"String content",
              "portal_url":"String content"
          },
          "role":2147483647
      }
  }
  </code></pre>
  
  <p>I have tried all kinds of strategies using code like:</p>
  
  <pre><code>result = json.loads(json_result, object_hook=lambda d: namedtuple('X', d.keys())(*d.values()))
  </code></pre>
  
  <p>and </p>
  
  <pre><code>def fun(d):
      if 'id' in d:
          yield d['id']
      for k in d:
          if isinstance(d[k], list):
              for i in d[k]:
                  for j in fun(i):
                      yield j
  </code></pre>
  
  <p>I can't get it to work properly. So:</p>
  
  <p><strong>Question 1:</strong>
  Can I convert json to (Anonymous) Python Objects and how?</p>
  
  <p><strong>Question 2:</strong>
  Can I edit the resulting dict in place?</p>
  
  <p><strong>Question 3:</strong>
  When all else fails; Does anybody have an idea how to achieve this?</p>
  
  <p>Thanks a lot!</p>