Having Trouble Linking to Files for JS in Max

    Jun 27 2022 | 6:19 pm
    I'm working on a Masters thesis at the moment where I am using javascript to use spectral metadata to compare between files to test for a number of criteria. I'm currently storing the metadata as arrays in local JSON files. I want to be able to link to the local JSON files, but I can't find any proper documentation on the idea bizarrely and I don't know the proper syntax to link to a local file. If anybody could lend a hand with how to link to the files and pull data from them, or even a helpful link, I would much appreciate it!
    All the best!

    • Jun 27 2022 | 10:34 pm
      I assume by "link to" you just mean read the file? One solution I've used goes roughly like this:
      var tmp_dict = new Dict() tmp_dict.import_json( <filepath.json> ) var json_data = JSON.parse( tmp_dict.stringify() )
    • Jun 29 2022 | 4:31 pm
      Hey Tyler, apologies for the confusion. I meant to read the file, yes. I gave that code a shot just there, it works perfectly! Thank you, and I wish you all the best.