Retrieving JSON Data in Postman - Local File or Internet?

I am using Postman and I need to retrieve JSON data. My goal is to retrieve it either from a local file on my computer or from the internet. However, I am facing difficulties in both cases.

Is it possible to retrieve JSON data from a local file in Postman? If yes, then how can I achieve this? I have tried using the fs module in the Postman Sandbox environment but I keep getting an error that fs.readFileSync is not a function.

If it is not possible to retrieve JSON data from a local file, then can I retrieve it from the internet instead? If yes, then how can I do this? I would appreciate it if you could provide an example or solution for this as well.

My Tests code:

const fs = require('fs');

let rawdata = fs.readFileSync('path/to/file.json');
let jsonData = JSON.parse(rawdata);


The fileSystem library is not available in the Postman Sandbox.

You cannot write or read directly to the local filesystem using Postman natively.

See here for what external libraries that Postman supports.
Postman JavaScript reference | Postman Learning Center

You can however, use the collection runner which allow you to iterate over a JSON file or CSV file.

If you don’t want to iterate over the JSON file per se, and just want an object with the JSON contents, then you can add the JSON into a single cell in a CSV file and then retrieve that using the collection runner. (This should work in Newman as well). It’s a workaround of sorts.

Using CSV and JSON Data Files in the Postman Collection Runner | Postman Blog

Retrieving the content from the Internet should work though as that should be just another API call. You haven’t really explained what difficulties are are having in that respect.

thanks for your answer,

Can you give me an example of the API call?

This will be down to where you are storing the data and what that API accepts.

Where were you considering storing the data? I assumed you had something in mind, when you mentioned the internet.

For example, a SharePoint list or similar technology.

Oh k. sorry for vague the explanation,

I’m storing at an endpoint such as http://notdropbox/data.json how can I fetch data from the target endpoint?

It will probably be a GET request of some sort.

What headers\authentication that server requires, will down to the API and documentation.

Usually these providers including examples of the requests in their documentation.

If you don’t know how to retrieve data from one API to use in another request, then please go through the Postman Learning Centre.

Introduction | Postman Learning Center

In particular, the core Postman training.


I would recommend starting with the “Galaxy APIs 101” and “Galaxy Testing and Automation” courses. (The Galaxy APIs has an error on the final submission, which I hope will be fixed at some point in the near future).

Finally, the following will explain how to set and use variables.

Using variables | Postman Learning Center