空手道新手:无法从带有连字符的响应中获取值
New to Karate : Unable to get the value from a response that has a hyphen
我有这样的回应
{
"id-claim" : "kajdfhskljf",
"documentation" : "https//documnets"
}
我正在努力
And print response.id-claim
但它不打印任何东西。不过,我可以获得文档的价值。知道为什么吗?
是的,这是一个 JavaScript / JSON 的东西,其中 -
是一个特殊字符,将被评估为 "minus sign" 所以你必须这样做:
And print response['id-claim']
我有这样的回应 { "id-claim" : "kajdfhskljf", "documentation" : "https//documnets" }
我正在努力
And print response.id-claim
但它不打印任何东西。不过,我可以获得文档的价值。知道为什么吗?
是的,这是一个 JavaScript / JSON 的东西,其中 -
是一个特殊字符,将被评估为 "minus sign" 所以你必须这样做:
And print response['id-claim']