Search code examples
scalagatling

Why is Gatling failing on a valid jsonpath?


I have the following .check on my returned body: (I changed the values for security reasons but the structure is the same)

 .exec(http("Get ids")
          .post("GetIds")
          .body(ElFileBody("json/getIds.json")).asJson
          .check(jsonPath("$...Types..[?(@.Type == 'web')].id").findAll.saveAs("IDLlist"))

But the transaction fails with "Gettting findAll.exists extraction crashed: end of input expected when trying to extract values from a returned body"

Gatling prints the body of the failed transaction, when I take the exact body that the transaction had just failed on to http://jsonpath.com/ and evaluate the jsonpath that had just failed, I get good results with no issues. This means that the returned body is correct and that the jsonpath is also correct. What is the issue then?


Solution

  • Thanks to Stephane from the Gatling forum, I found that $..Files[?(@.Format == 'DASH_Web')].URL is correct works instead of the variation that I had.

    Since http://jsonpath.com/ was able to extract the correct path using my original syntax, I think its important to note that Gatling jsonpath is much more conservative in its syntax.