Looking for example/tutorial for initializing a database from a JSON file

I’ve built a local node server for interacting with a cloud database and I’m using Postman for the UI. I’m trying to find an example or tutorial that shows how I can loop through a JSON file to initialize the database. Things I’ve found so far have given me bits and pieces, but I’m not sure how to put it all together.

For instance, some examples that I have seen use variables in the request URL for object attributes, but these examples have only one or two attributes. My JSON objects have multiple attributes and so I am trying to see how to replace the request body for each iteration of the loop with the current object’s attribute/value pairs.

Any leads in the right direction would be greatly appreciated.

Thanks

If I have understood your question, then try the following: https://learning.getpostman.com/docs/postman/collection_runs/working_with_data_files/

1 Like

My JSON objects have multiple attributes and so I am trying to see how to replace the request body for each iteration of the loop with the current object’s attribute/value pairs.

Couldn’t you accomplish this with dynamic variables, such as “property”: “test {{$guid}}”, in the body? You could seed/hydrate your database with iterations using the Collection Runner or newman.

Or do you have a static dataset that you want to recreate each time?