title: Remove 'u' from json data using Python
body: <p>I have a Python code which basically extracts the data from Amazon SQS, I need to index this JSON data to Elasticsearch. Currently my code looks like:</p>
  
  <pre><code>import os
  import json
  import uuid
  import time
  import boto.sqs
  import boto
  from boto.sqs.connection import SQSConnection
  from boto.sqs.message import Message
  from boto.sqs.message import RawMessage
  from ConfigParser import SafeConfigParser
  import ast
  
  parser = SafeConfigParser()
  parser.read('/home/ubuntu/config.ini')
  
  #get details via config file
  
  region = parser.get('default', 'aws_region')
  access_key = parser.get('default', 'aws_access_key')
  secret_key = parser.get('default', 'aws_secret_key')
  queue_name = parser.get('default', 'sqs_queue_name')
  
  sqs = boto.sqs.connect_to_region(region,aws_access_key_id=access_key,aws_secret_access_key=secret_key)
  q = sqs.get_queue(queue_name) #SQS queue name
  
  m = q.read(visibility_timeout=15)
  if m == None:
    print "No message!"
  else:
      a = m.get_body()
      print a
      print type(a)
  
      new_list = json.loads(a)
      print new_list
      print type(new_list)
  </code></pre>
  
  <p>This produces a result as :</p>
  
  <pre><code>{
      "facter": {
          "blockdevice_xvda_size": 8589934592,
          "blockdevices": "xvda,xvdb",
          "fqdn": "ip-1-12-5-9.us-west-2.compute.internal",
          "hardwaremodel": "x86_64",
          "hostname": "ip-1-12-5-9",
          "instanceid": "i-a54d7c",
          "ipaddress": "1.12.5.9",
          "is_virtual": "true",
          "kernelrelease": "3.13.0-48-generic",
          "lsbdistcodename": "trusty",
          "lsbdistdescription": "Ubuntu 14.04.2 LTS",
          "macaddress": "2:00:a:66:61:4f",
          "memoryfree": "3.56 GB",
          "memorytotal": "3.68 GB",
          "netmask": "255.255.255.12",
          "operatingsystem": "Ubuntu",
          "operatingsystemrelease": "14.04",
          "processor0": "Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz",
          "processorcount": "1",
          "timezone": "UTC",
          "uniqueid": "660a4f41",
          "uptime": "23:36 hours"
      }
  }
  &lt;type 'unicode'&gt;
  {u'facter': {u'kernelrelease': u'3.13.0-48-generic', u'memoryfree': u'3.56 GB', u'memorytotal': u'3.68 GB', u'processorcount': u'1', u'timezone': u'UTC', u'operatingsystem': u'Ubuntu', u'uptime': u'23:36 hours', u'hostname': u'ip-1-12-5-9', u'is_virtual': u'true', u'blockdevices': u'xvda,xvdb', u'hardwaremodel': u'x86_64', u'netmask': u'255.255.255.192', u'blockdevice_xvda_size': 8589934592, u'uniqueid': u'660a4f41', u'ipaddress': u'10.102.65.79', u'lsbdistdescription': u'Ubuntu 14.04.2 LTS', u'macaddress': u'2:00:a:66:41:4f', u'operatingsystemrelease': u'14.04', u'processor0': u'Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz', u'instanceid': u'i-a54d7c', u'fqdn': u'ip-1-12-5-9.us-west-2.compute.internal', u'lsbdistcodename': u'trusty'}}
  &lt;type 'dict'&gt;
  </code></pre>
  
  <p>As you can see that its a dictionary having unicode. I need to extract "instanceid" from this dictionary and use it index it in ES. I am stuck on how to extract the index id. I tried:</p>
  
  <pre><code> ast.literal_eval(json.dumps())
  </code></pre>
  
  <p>What exactly am I doing wrong?</p>