How to assert the value of two attributes within an array are equal

Hi,

New to postman. I am looking for some help in adding an assertion in postman tests to check two attribute values are equal. In below example, I want to assert “available” value is equal to “stock” value under Details array. Could someone please provide me with a script for this?
{
“org”: “RRR”,
“Channel”: "US ",
“Products”: [
{
“productId”: “12345678”,
“Types”: [
{
“Type”: “SHIP”,
“Details”: [
{
“segment”: “Men”,
“available”: 100.0,
“Stock”: 100.0,
“Locations”:
}
]
}
]
}
]
}

Hi @vkanch, Welcome to the community!

The sample which you have given above seems to have multiple array elements.

Will it be possible to have multiple products? If so, then you may need to loop through each and every element to know if the values are equal.

Hope this helps :slight_smile: