I have a json file, which I can easily load into a dict using python. The value of one of the elements is a base64-encoded string, but the output type of this value due to json loading, is str. For example:
'a': 'BAAAAAAAAj5FEMB=='
This is not a valid string, BTW. The real one is proprietary.
I've tried to decode this str a number of ways, but I've been unsuccessful because all examples I've seen assume that the string is already base64 encoded not as str. Base64 decoding throws a error, and if I try base64 encoding/decoding I get the same string back (as expected). I need a way to convert the str to a base64 type without encoding it so I can then decode it.
Help would be appreciated.
EDIT:
I tried the following
x = {'a':'kjuhdfxkjahgfdhj'}
y = x['a'].encode('utf-8')
z = base64.b64decode(y)
z is just a binary string that looks something like
b'\x04\x00\x00\x00AJ ...........'