title: json.loads TypeError: string indices must be integers
body: <p>Here is the content of the JSON file</p>
  
  <pre><code>{
  "error": {
  "class": "com.attask.common.AuthenticationException",
  "message": "Authentication Exception: Authentication Exception: {0}"
  }
  }
  </code></pre>
  
  <p>Here is the code where I'm trying to parse the above content. The same code works perfectly fine for parsing other JSON files. But while parsing the above mentioned content I'm getting an error "TypeError: string indices must be integers".</p>
  
  <pre><code>import json                                     
  fObj = open("attask1.json","r");                
  res = fObj.read().encode('utf-8');              
  fObj.close();
  data = json.loads(res);                         
  for each in data['error']:                      
      WFErrorClass = each['class'];
      WFErrorMessage = each['message'];
      print WFErrorMessage;
      print WFErrorClass;
  </code></pre>
  
  <p>Anyone please explain why it is happening and suggest me how to overcome this </p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Python version is 2.7.14</p>
  
  <p>Note: Indentation is perfect and no errors with spacing</p>