title: Cant parse boto3 client json response using python
body: <p>i am new in <strong>Python</strong> language. I need to get all <strong>Amazon-Web-Services Identity and Access Management (Amazon-IAM)</strong> policy details using <strong>Boto 3</strong> and <strong>Python</strong>.</p>
  
  <p>I tried to parse <strong>JSON</strong> output from <strong>Boto 3</strong> client and also need to save <code>key-value</code> pair into a map (policyName, Arn). Sample <strong>JSON</strong> output is like this:</p>
  
  <pre><code>{
      'ResponseMetadata': {
          'HTTPStatusCode': 200,
          'HTTPHeaders': {
              'vary': 'Accept-Encoding',
              'content-length': '19143',
              'content-type': 'text/xml',
              'date': 'Thu, 23 Feb 2017 06:39:25 GMT'
          }
      },
      u 'Books': [ {
          u 'PolicyName': 'book1',
          u 'Arn': '002dfgdfgdfgdfgvdfxgdfgdfgdfgfdg',
          u 'CreateDate': datetime.datetime(2017, 2, 22, 13, 10, 55, tzinfo = tzutc()),
          u 'UpdateDate': datetime.datetime(2017, 2, 22, 13, 10, 55, tzinfo = tzutc())
      }, {
          u 'PolicyName': 'book2','
          u 'Arn': '002dfgdfgdfgdfgvdfxgdfgdfgdfgfdg',
          u 'CreateDate': datetime.datetime(2017, 2, 22, 13, 10, 55, tzinfo = tzutc()),
          u 'UpdateDate': datetime.datetime(2017, 2, 22, 13, 10, 55, tzinfo = tzutc())
      }]
  }
  </code></pre>
  
  <p>I have following code</p>
  
  <pre><code>iampolicylist_response = iamClient.list_policies(
      Scope='Local',
      MaxItems=150
  )
      print iampolicylist_response
      res=json.dumps(iampolicylist_response)
  print res
  ret={}
  for i in res["PolicyName"]:
    ret[i["PolicyName"]]=i["Arn"]
  return ret  
  </code></pre>
  
  <p>Using <code>json.loads</code>, it shows error like this</p>
  
  <blockquote>
    <p>TypeError: expected string or buffer</p>
  </blockquote>
  
  <p>Using <code>json.dumps</code>, it shows error like this</p>
  
  <blockquote>
    <p>TypeError: datetime.datetime(2017, 2, 22, 13, 10, 55, tzinfo=tzutc()) is not JSON serializable</p>
  </blockquote>
  
  <p>What is actual issue?</p>