I have this array set up from a previous GET response:
[85071929,85071930,85071979,85072029,85071899,85071900,85071901,85071902,85071903,85071904,85071905,85071906,85071907]
This is set as a collection variable I setted up from a previous call
These are a set of Ids and I want to compare with the debtor.id of this response because if an ID from that list is not found I want to use it for a POST request
[
{
"objid": 26425,
"holdRef": "AP",
"debtor": {
"id": 485922
}
},
{
"objid": 26426,
"holdRef": "AP",
"debtor": {
"id": 490503
}
}
]
This is what I tried:
var jsonData = pm.response.json();
var debtorIds = pm.collectionVariables.get('debtorIds');
for (var i = 0; i < jsonData.length; i++) {
for (var j = 0; j < debtorIds.length; j++) {
if ( !JSON.stringify(jsonData[i].debtor.id).includes(debtorIds[j])){
pm.collectionVariables.set('debtorForPost', debtorIds[j])
break;
}
}
}
but I’m getting this: “[”
not sure what I should do, thanks in advance for your help!