Hi I’m trying to use a Data File to replace property values in the Collection Runner. My problem is I can’t figure out how to access the Child property of a Property with a Data file variable when I run the collection.
This is my Data File:
[
{
"firstname" : "Alice",
"lastname" : "Smith",
"totalprice" : 300,
"depositpaid" : true,
"bookingdates" : {
"checkin" : "2018-01-05",
"checkout" : "2019-01-05"
},
"additionalneeds" : "Breakfast"
},
{
"firstname" : "aasDDFFasdfasDfFAsdf",
"lastname" : "Yule",
"totalprice" : 100,
"depositpaid" : true,
"bookingdates" : {
"checkin" : "2018-01-01",
"checkout" : "2019-01-01"
},
"additionalneeds" : "Breakfast"
},
{
"firstname" : "Brad",
"lastname" : "120934839212314",
"totalprice" : 11900,
"depositpaid" : false,
"bookingdates" : {
"checkin" : "2018-01-01",
"checkout" : "2019-01-01"
},
"additionalneeds" : "Breakfast"
}
]
This is my collection I’m experimenting in:
https://www.getpostman.com/collections/8d4d016855291dafb773
If you run the collection, the response body gives “Invalid Date”.
Tried changing the variable to loads of stuff like:
"{{bookingdates}}.checkin"
"bookingdates.{{checkin}}"
And it ain’t happening! I get stuff like [Object object].{{checkin}} but it won’t take the “2018-01-01”, for example, from the Data File no matter what syntax I try out for the value’s address.
Any advice? I’ve looked over https://learning.getpostman.com/docs/postman/collection_runs/working_with_data_files/, but this only shows an example of a flat data file.
Additionally: I’m guessing it’s going to be even more of a pain to figure out how to do this if the Data File contains arrays too, so any example of how to handle that would also be appreciated.
Thanks.