Convert JSON string to dict using Python
Solution 1:
json.loads()
import json
d = json.loads(j)
print d['glossary']['title']
Solution 2:
When I started using json, I was confused and unable to figure it out for some time, but finally I got what I wanted
Here is the simple solution
import json
m = {'id': 2, 'name': 'hussain'}
n = json.dumps(m)
o = json.loads(n)
print(o['id'], o['name'])
Solution 3:
use simplejson or cjson for speedups
import simplejson as json
json.loads(obj)
or
cjson.decode(obj)