下面是我遇到错误的代码段。
* def json = {"test" : { "data.a":'value',"data.b":'value2' }}
* print json.test["data.a"] // This line is working getting value 'value'
* set json.tes["data.a"] = 'hello' // This line is failing with error "String index out of range: -1
Response:
[java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1967)
at com.intuit.karate.JsonUtils.setValueByPath(JsonUtils.java:257)
at com.intuit.karate.Script.setValueByPath(Script.java:1519)
at com.intuit.karate.Script.setValueByPath(Script.java:1489)
at com.intuit.karate.Script.setValueByPath(Script.java:1479)
at com.intuit.karate.StepDefs.setNamedByPath(StepDefs.java:572)
at com.intuit.karate.StepDefs.setByPath(StepDefs.java:562)
at ✽.* set json.tes["data.a"] = 'hello' // This line is failing with error "String index out of range: -1
无法使用SET关键字动态设置“ data.a”的值。 请帮忙。