Please assist in getting the property type of a nested element from a JSON response in postman. Below is my response after doing a POST.
{
"MyList": [
[
{
"id": 1,
"name": "Test"
}
]
]
}
I would like to check the name and id properties if they are of type number and string. Below is my code but getting error : Cannot read property '0' of undefined
.
pm.test("Check schema and datatype", () =>{
var jsonData = pm.response.json();
pm.expect(typeof(jsonData[0].id)).to.eql('number');
pm.expect(typeof(jsonData[0].name)).to.eql('string');
})