[issue21182] json.loads errors out on valid JSON

akira report at bugs.python.org
Wed Apr 9 20:37:40 CEST 2014


akira added the comment:

You need to escape backslashes inside a Python string literal or use raw-string literals:

  >>> import json
  >>> json.loads(r'["[\"Residential | Furniture | Cabinets\",\"119.99\"]"]')
  [u'["Residential | Furniture | Cabinets","119.99"]']

If the backslashes are unintentional then you could remove them:

  >>> json.loads('[["Residential | Furniture | Cabinets","119.99"]]')
  [[u'Residential | Furniture | Cabinets', u'119.99']]

Note: the result is different

----------
nosy: +akira

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21182>
_______________________________________


More information about the Python-bugs-list mailing list