I'm creating test automation scripts through postman. I want to pass a nested array in postman body
{
"fruit":{{fruit}},
"Vehicles":[
{
"car":{{car}},
"bike":{{bike}}
}
]
}
I want to pass the vehicles array.
When I executed the APIs I get these vehicles as a empty variables. data is not passing
The Response body as follows
{
"fruit":"mango",
"Vehicles":[
{
"car":{{car}},
"bike":{{bike}}
}
]
}
The external json data file
[
{
"fruit":"mango",
"Vehicles":[
{
"car":"BMW",
"bike":"YAMAHA"
}
]
}
]
I'm executing this with postman collection runner and data inside the nested array is not passing.
Your request body is not valid JSON, after the values from the file have been inserted. You don't have quotation marks araound the values.
Try this:
{
"fruit":"{{fruit}}",
"Vehicles":[
{
"car":"{{car}}",
"bike":"{{bike}}"
}
]
}