How to check if json reponse has correct value

I am using gatling 2.3.1 version.
I have to verify that json response from a request contains correct value. I could not use check( because even if json response has inc correct data request returns status code as 200.

I have tried following code-

exec(http(“do something”))


Help much appreciated

You can use jsonPath checks:

Hi Katerina,
Let me try to explain what I am trying to do…

  1. We call 1 post request to this we pass json as {“username” : “abc”, “password” : “abcdef”}
  2. now in next get request returns us json, which is like{ “id”:13231… {“username” : “abc”, “email” : “”} … }
  3. we have to check that logged in user name that we have passed and which we get in the next request are same or not.

Thanking in advance.

I think you can use a String using Gatling EL in jsonPath as well in other types of checks.
So, assuming you have your username in a session variable, you can use this variable in jsonPath expression or another type check expression.

I haven’t tried it myself, but there is at least a regex example in documentation (

regex("""<td class="number">ACC${account_id}</td>""")
where ${account_id} is a session variable