I am sending a request to an API and it returns this JSON response
'{"Reply":{"Header":{"Method":"mGSSCBetHistory","ErrorCode": "0","MerchantID":"BETSTARtest","MessageID": "H140201152657m6k3f"},"Param":{"TotalRecord":"1","BetDatas":"[{"Column1":""}]","ErrorDesc": ""}}}'
when I try to convert it to dictionary whether ast.literal_eval or json.loads it returns this error:
Traceback (most recent call last):
File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/celery/app/trace.py", line 367, in trace_task
R = retval = fun(*args, **kwargs)
File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/celery/app/trace.py", line 622, in __protected_call__
return self.run(*args, **kwargs)
File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/provider/KENO/tasks.py", line 127, in run
['Reply', 'Param', 'BetDatas'], 'post')
File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/core/classes.py", line 217, in check_records
self.result = response.json()
File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/requests/models.py", line 826, in json
return complexjson.loads(self.text, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting ',' delimiter: line 1 column 169 (char 168)
The reason for this is because of the value of the BetDatas which has a double quote inside a double quote.. Is there an easy workaround for this? Because the only proper solution that I can think of is to tell the third party that I've been sending request to change their JSON response.