I am trying to use json.loads() in python
I get the error:
the JSON object must be str, not 'bytes'
a = {'h': '123', 'w': '12345', 'data': "b'eyJod2lkIjpwomfcwpvepovnepovqrepniLLKJAMSNDMSNDMAWEFMOEDAad='"}
a.update(json.loads(base64.b64decode(a['data'])))
Here the 'data' portion of a was being loaded in as a json dump with b64encoding.
'data':base64.b64encode(json.dumps(test).encode()); where test = some string eg('epovqrepniLLKJAMSNDMSNDMAWEFMOEDAad=')
I have tried using:
a.update(json.loads(base64.b64decode(a['data']).decode('utf-8')))
Giving me a 'utf-8' codec can't decode bytes in position: invalid continuation byte
I have also tried using decodebytes instead of b64decode to no avail.
I'd really appreciate any help!
datavalue looks pretty corrupted. Do you know what"b'eyJ...was before it was encoded with JSON and B64? By removing the outer quotes and applyingb64decodeto the byte stringb'eyJ...', I get something that looks like JSON in the beginning (b'{"hwid":), but the remainder is clearly not valid JSON.