how to escape at sign (@) in groovy gpath

Viewed 233

I have a very specific use case while using rest-assured for testing REST API. I would like to retrieve a value of '@odata.type' from following JSON response;

{
 "value": [
            {
                "@odata.type": "#example.type1.",
                ...
             },
             {
                "@odata.type": "#example.type1.",
                ...
             },
            ...
          ]
      }

I tried something likle

get(/path).then().body("value.@odata.type",hasItems("expected_velue"));

but end up getting this error

java.lang.IllegalArgumentException: The parameter "null" was used but not defined. Define parameters using the JsonPath.params(...) function
...

How can I escape @odata.type so that it will be treated as a single attribute to retrieve its value?

Thanks in advance

0 Answers
Related