I have a JSON Response :
[{
"dateTime": 1603650600000,
"supplierName": "Mr Orange GP ",
"gender": "male",
"supplierId": "788",
"appointmentId": 454687,
"tentativeAppointmentCode": "5f8ff4a8a9d5f"
}, {
"dateTime": 1603650600000,
"supplierName": "Mr Kennedy test ",
"gender": "male",
"supplierId": "600",
"appointmentId": 573993,
"tentativeAppointmentCode": "5f8ff4a8a9d5f"
}, {
"dateTime": 1603651500000,
"supplierName": "Mr Orange GP ",
"gender": "male",
"supplierId": "788",
"appointmentId": 454688,
"tentativeAppointmentCode": "5f8ff4a8a9d5f"
}, {
"dateTime": 1603651500000,
"supplierName": "Mr Kennedy test ",
"gender": "male",
"supplierId": "600",
"appointmentId": 573994,
"tentativeAppointmentCode": "5f8ff4a8a9d5f"
}]
I need to extract the values of first occurrence of dateTime
, AppointmentId
and tentativeAppointmentCode.
Tried below mentioned code but didn't work in this case.
var jsonData=JSON.parse(responseBody);
postman.setEnvironmentVariable("dateTime",jsonData.dateTime);
How can I extract these values and store in a variable so that I can use it in other requests?
I have done something like this for storing a token for later use