And I want to use the data file in my POST body each iteration (I know, I only have one object so it’ll iterate once which is fine for now)
So the raw JSON data that will be posted to the endpoint will be:
“{{address.addressLine1}}” is literally sent to the server instead of the revelent value in the JSON data file, I’m expecting it to be “123 Fake Street”
Any idea if this functionality has been added in the last few years? From the things I’m trying, it appears that nested JSON in external files still doesn’t work - but I might be missing something.
Do you know of any way to bring nested JSON in from an external file maybe as one big string and then parse it in a pre-req script?
in your input JSON file, add a parent object that contains all of your nested JSON
create a local variable from the nested JSON in the data file in the pre-request: var inputJSONdata = pm.iterationData.get(“parentObject”);
create a stringified environmental variable: pm.environment.set(“envInputJSONdata”,JSON.stringify(inputJSONdata));
now you can work with the nested elements of that - for instance, you can populate the request body with the entire variable by putting {{envInputJSONdata}} in the Body
Hi, I have the exact same requirement. I am not able to follow your steps. Can you help me how to read the nested json from file . This is how actual JSON looks like in request.
Highlighted in bold is the section that I need to read from the JSON file.