r/programminghelp • • Oct 25 '21

Other Having Image locations in JSON dataset

I'm making a data sets for game which is suppose to hold the default information for monsters and items. (which when acquired by the user would be copied to their own dataset and able to change) But I want to include the picture with the data set. I though I could do so via file location as the json file in in the same file of the images or shares a file with the file the pictures are in.

I'm only finding ways to do this via urls

4 Upvotes

3 comments sorted by

1

u/ConstructedNewt MOD Oct 25 '21

A file system path (unix-like syntax) is a URL to my knowledge

1

u/WittyWiki Oct 25 '21

I'm using

"Images\Cozten\Cozten_01.jpeg"

as the json and Images file are in the same file, but I'm getting a bunch of errors due to the "\"

1

u/ConstructedNewt MOD Oct 25 '21

You have to sanitise the paths. The correct URL would probably be using forward slashes. Then you would find the actual location using file system utilities and the os separator