Reputation: 89
If I have a json file with fields having special chars (in my case dots) how can I access the field value in Karate?
For example having a json file called example.json
{
"field1" : {
"field2" : "value2",
"field.3" : "value3"
}
}
if I want to get the value of "field.3" field how can do?
Scenario: read a json file
* def myJson = read("example.json")
* match myJson.field1.field2 == "value2"
* match myJson.field1.field.3 == "value3" # this fails
* match myJson.field1."field.3" == "value3" # this fails
* match myJson.field1.'field.3' == "value3" # this fails
* match myJson.field1.'field\.3' == "value3" # this fails
Upvotes: 1
Views: 633