Read content from file in raw json request body

Hello @bpricilla , thank you so much for your reply :slight_smile:. So this is really helpful but I am a bit confused. I need to the email field in the request get its content from an entire json file which is not starting with an array ([]).

What I have tried is in the runner, I read the file as data but I gave the error “json file should be an array”. Okay, I have converted it to an array which has one object in it. Then in the pre-request script, I tried to get the data with pm.environment.set("data", data[0]);. Then in the body, I tried to pass it via

"data": {{data}}

But it didn’t helped, when I run the runner it shows that data becomes null in the request body.

Sorry if I’m pushing too much :slight_smile:

1 Like