I have a json field which is called template.welcome.email and I am writing a unit test that checks if that field is present in the reply from the server but I can\'t find a
These days (e.g. io.rest-assured.json-path:3.0.1
) the notation seems to be without brackets:
// Some Groovy OData V4 $count test
// Response looks like:
// { "@odata.count": 2, ... }
body "'@odata.count'", equalTo(2)
I found the corresponding hint in this Git issue.
As Ida pointed out:
Use brackets and quotes around your field. For example, if your field is valid.key.with.dot
Refer to it as ['valid.key.with.dot'] and in JsonPath, try
JsonPath.read(jsonString, "$.['valid.key.with.dot']")
Use brackets and quotes around your field. For example, if your field is valid.key.with.dot
Refer to it as ['valid.key.with.dot']
and in JsonPath, try
JsonPath.read(jsonString, "$.['valid.key.with.dot']")
See this thread also: https://groups.google.com/forum/#!topic/jsonpath/7YvgXWP1_7Y