How can I read a JSON file from within a pre-request script without using the runner?

My question:
How can I read a JSON file from within a pre-request script without using the collection runner?

Feeding a JSON file into the collection Runner works just fine, but I would also like individual requests to be able to read a value from a file within the Postman working directory.

For example, this is how I would achieve this inside a pre-request script if I could access Node’s file system module:const data = JSON.parse(fs.readFileSync('./path/to/file.json')).

I want to be able to read values inside a JSON file within the Postman working directory :slight_smile:

Hey @GrayedFox :wave: Welcome to the Postman Community :tada:

This question is often asked in Community and a short answer is “You cannot access local file from Postman sandbox due to security reasons”

However, there are some workaround as discussed in this thread comment.

Hope this helps! :wink: