How to parse somewhat wrong JSON with Python?
Solution 1:
since YAML (>=1.2) is a superset of JSON, you can do:
>>> import yaml
>>> s = '{value: "82363549923gnyh49c9djl239pjm01223", id: 17893}'
>>> yaml.load(s)
{'id': 17893, 'value': '82363549923gnyh49c9djl239pjm01223'}
Solution 2:
You can use demjson.
>>> import demjson
>>> demjson.decode('{foo:3}')
{u'foo': 3}
Solution 3:
You could use a string parser to fix it first, a regex could do it provided that this is as complicated as the JSON will get.