How do store Image data (bytes-like) in JSON using Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do store Image data (bytes-like) in JSON using Python?

2nd Feb 2019, 2:57 AM
danvetio
danvetio - avatar
2 Answers
+ 2
I suppose you can read an image as bytestring and store it as dictionary value. Dictionaries are same as JSON in python. If you want to store it in a JSON file, do: import json; json.dump(mydict). Use json.load("file.json") to read a json file.
3rd Feb 2019, 3:19 AM
Rugved Modak
Rugved Modak - avatar
+ 1
I suppose you can read an image as bytestring and store it as dictionary value. Dictionaries are same as JSON in python. If you want to store it in a JSON file, do: import json; json.dump(mydict). Use json.load("file.json") to read a json file.
3rd Feb 2019, 3:19 AM
Rugved Modak
Rugved Modak - avatar