0

I want to do a sanity-check on the response I get from a request and verify that element1 is 2017 in the below response:

body=
{
  "id"        : { "element1": "2017", "element2": "ST", "nivaa": "land", "navn": "element3", "nr": "0" },

How do I do that in something like this format:

.check(jsonPath("$._element").is("2017")))

The code above does not work.

What do I put in where it says "$._element"

Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
Magnus Jensen
  • 905
  • 6
  • 36
  • 73

1 Answers1

1

Since you are using this in Gatling project, I may assume you work with JSONpath. According to its documentation, if you want to get a value of element1 field from the body, you have to use following construction:

$.id.element1

or its equivalent:

$[id][element1]

Please, let me know about your result

Alex Fruzenshtein
  • 2,846
  • 6
  • 32
  • 53