Hello everyone
I’m having a problem passing whole to object to variable then use it as a body in call.
Here is how my data looks like:
[
{
"id:“6464564646”,
“name”:“Test”,
"Country:“EN”,
“some array”:[
]
},
{
"id:“6464564646”,
“name”:“Test”,
"Country:“EN”,
“some array”:[
]
},
{
"id:“6464564646”,
“name”:“Test”,
"Country:“EN”,
“some array”:[
]
}
]
On request body i managed get some values from iteration.
Hi!
I understand you are reading a data file to runner and trying to access each object as a variable.
Current format of the data file only allows you to access "id“, “name”, “Country”, “some array”, i.e. the keys of each object, via iterationData.get() method.
If you want to make each object accessible by a variable, you would need to something like:
const User = function (id, email, name) {
this.id = id
this.email = email
this.name = name
}
const id = pm.iterationData.get(‘id’)
const email = pm.iterationData.get(‘email’)
const name = pm.iterationData.get(‘name’)