Hi,
I have the following json response:
{
“items” : [
{
“populationLevel” : “LEVEL1”,
“reserved” : [ ],
“id” : “ID123”,
“contactId” : “CONTACT01”,
“contactName” : “CONTACTNAME1”,
“roleType” : “ROLERTYPE1”,
“roleName” : “ROLERNAME1”,
“serviceLine” : “SERVICELINE1”,
“rank” : 1,
“status” : “ACTIVE”,
“lastModifiedOn” : “2018-04-23T12:54:46.000Z”,
“customerId” : “CUSTOMERID1”,
“customerName” : “CUSTOMERNAME1”,
“partnerId” : “PARTNERID1”,
“customerIds” : [ ]
},{
“populationLevel”: “LEVEL2”,
“reserved”: [],
“id”: “ID345”,
“contactId”: “CONTACT02”,
“contactName”: “CONTACTNAME2”,
“siteId”: “SITEID1”,
“siteName”: “SITENAME1”,
“roleType”: “ROLERTYPE2”,
“roleName”: “ROLERNAME2”,
“serviceLine”: “SERVICELINE2”,
“rank”: 2,
“status”: “ACTIVE”,
“lastModifiedOn”: “2019-08-05T14:57:29.000Z”,
“customerId”: “CUSTOMERID2”,
“customerName”: “CUSTOMERNAME2”,
“partnerId”: “PARTNERID2”,
“customerIds”: []
}
],
“start”: 0,
“limit”: 100,
“totalCount”: 2
}
and I need to get the number of elements inside “Items” main node with missing siteId property (1 element in this case).
I tried this (https://jsonpath.herokuapp.com/ or any other json path evaluator):
$…items[?(!@.siteId)].count.saveAs(“numberOfRecords”) <— this is returning 1 element on webpage evaluator…but when I run gatling it is returning the following error:
jsonPath($…items[?(!@.siteId)].count.exists extraction crashed: ‘"’ expected but ‘!’ found
Anyone can help how to negate that expression ([?(!@.siteId)]) on gatling. it seems that the negate “!” character is not being recognized on gatling (jackson lib)