I am trying to extract the value from json response to a variable and use it different api call.
I am always getting response as {equipmentId: 35001565}
I need only 35001565 in my variable.
Hi @allenheltondev , if there are nested values, for eg,
sort": [
{
“direction”: “ASC”,
“property”: “name”,
“ignoreCase”: false,
“nullHandling”: “NATIVE”,
“ascending”: true
}
How can I extract the value of ‘direction’ and use it for further assertions?
Tried using : pm.expect(jsonData.direction).to.eql(“ASC”);
got error : AssertionError: expected undefined to deeply equal ‘ASC’
Your response is an array, so you’ll have to handle it by index. Do you know if you will always only have one result? If so, you could update your assertion to: