I am scraping a website and it has this JSON data in return.
https://pastebin.com/R50eTqrD this is output of print( repr( string ) )
https://pastebin.com/VH6JrDMG this is output of print( string )
I am doing
resp = json.loads(resp)
But its giving me this error
ValueError: Invalid \escape: line 1 column 170 (char 169)
I found a solution here and it suggested me to do
resp = json.loads(HTMLParser().unescape(resp.decode('unicode-escape')))
But it now throws this error
UnicodeEncodeError: 'ascii' codec can't encode characters in position 51-59: ordinal not in range(128)
I have tried several solutions like
json.loads(HTMLParser().unescape(resp.decode('unicode-escape')).encode("utf-8"))
and many more but none of it worked for me.