How to convert Binary into JSON

Viewed 36

I'm having trouble to convert a binary file in which I have data from a FLASH Memory into a JSON or a file readable.

I'm trying to read the file this way in Python:

fileName = "TST477 DeviceMemory.bin"
with open(fileName, mode='rb') as file: # b is important -> binary
    fileContent = file.read()
print(fileContent)

I attach a sample of the data I'm trying to convert: Data Sample Added

And if I try to load it into JSON

data = fileContent.decode("utf-8")
s = json.dumps(data, indent=4, sort_keys=True)

throws the following error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe5 in position 8:
invalid continuation byte

Please can someone help me?

Thank you!

0 Answers
Related