I am trying to decrypt a json dictionary with strings as keys. The result is a dictionary with unicode keys. What is the best way to decode a dictionary with string keys? Better: how can I prevent strings from being decoded to Unicode strings? Of course, after that I can contact ...
What's happening:
>>> import simplejson
>>> simplejson.loads('{"bar":["baz", null, 1.0, 2]}')
{u'bar': [u'baz', None, 1.0, 2]}
>>> simplejson.loads('"bar"')
u'bar'
Desired behavior:
>>> import simplejson
>>> simplejson.loads('{"bar":["baz", null, 1.0, 2]}', ...?)
{'bar': ['baz', None, 1.0, 2]}
>>> simplejson.loads('"bar"', ..?)
'bar'
source
share