Hi all!
This post relates to Gatling’s handling of jsonpath.
Given the sample jsonpath (attached) which I took from Gatling’s JsonPath tests, the following jsonpath should give me the title of books which have an ISBN: $…book[?(@.isbn)].title
This is covered by the following test: gatling/JsonPathSpec.scala at main · gatling/gatling · GitHub
My understanding is that to find books WITHOUT isbn, we should just need to include a negative operator to the jsonpath - e.g. $…book[?(!@.isbn)].title
I can’t see any tests for this particular scenario. I’ve run the sample json through the online checker at jsonpath.com, and adding the negative operator works fine.
When I try to do the same in a Gatling test, the test crashes with the message “extraction crashed: end of input expected”. Note - the same jsonpath works fine if I remove the negative operator.
Given the sample json, I wouldn’t really want to have to write code to extract the full list, as well as a list containing isbn, and then remove one from the other - although this may be a workaround, it’s not ideal.
Thanks in advance!
Barry
sample.json (837 Bytes)