How do store Image data (bytes-like) in JSON using Python? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

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

2nd Feb 2019, 2:57 AM
danvetio
danvetio - avatar
2 Réponses
+ 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