Correlation using JAVA DSL

.check(jmesPath("$.data.trackCode").saveAs("trackCode"))

The above code is throwing an error stating

jmesPath($.data.trackCode).find.transform.exists extraction crashed: i.b.j.p.ParseException: Unable to compile expression "$.data.trackCode": syntax error token recognition error at: '$' at position 0, syntax error extraneous input '.' expecting {'!', '(', '*', '[', '{', '[?', '@', '', RAW_STRING, JSON_CONSTANT, NAME, STRING} at position 1`

I like to extract the trackCode from below response and save it to variable say “trackCode”:
Response Body
{"data":{"trackCode":"XYZ","isNewUser":false}}

Expected Result: trackCode=XYZ

Also, could someone please share the Gatling cheat sheet URL or user guide with a few correlation examples?
Thanks

Hello,

jmesPath is not jsonPath

Try with jmesPath("data.trackCode") instead.
Documentation:

Cheers,

1 Like

Also, here’s the reference website for JMESPath where you can learn the proper syntax: https://jmespath.org/

1 Like

Thanks @sbrevet and @slandelle . I will explore other ways for extracting like regex, json etc