How Do You Pass A Byte Array In A Json

[Solved] How Do You Pass A Byte Array In A Json | Kotlin - Code Explorer | yomemimo.com
Question : How do you pass a byte array in a JSON request?

Answered by : aman-kumar-verma

import chardet
# check your bytes object encoding
encoding = chardet.detect(your_byte_object)['encoding']
# decode it before saving
data = {"data": your_byte_object.decode(encoding)}
with open('request.txt', 'w') as file: json.dump(data, file)

Source : https://buggyprogrammer.com/ | Last Update : Thu, 11 Aug 22

Answers related to how do you pass a byte array in a json request

Code Explorer Popular Question For Kotlin