How Do You Put an Image File in a Json Object?
I Am Making a Database for Video Games, Each Containing Elements Like Name, Genre, and and Image of the Game. Is It Possible to Put Images into a Json Object...
I am making a database for video games, each containing elements like name, genre, and and image of the game. Is it possible to put images into a json object for the db? If not is there a way around this?
5 Answers
I can think of doing it in two ways:
1.
Storing the file in file system in any directory (say dir1) and renaming it which ensures that the name is unique for every file (may be a timestamp) (say xyz123.jpg), and then storing this name in some DataBase. Then while generating the JSON you pull this filename and generate a complete URL (which will be )and insert it in the JSON.