* def xyz = 'abc'
* def abc = {"pratyush" : '#(xyz)'}
* def editJson =
"""
function(s)
{
var x = s.x
karate.log(x)
}
"""
* def p = call editJson ({"x" :abc})
实际输出-{pratyush = abc} 预期的输出-{“ pratyush”:'abc'}
答案 0 :(得分:1)
使用漂亮的样式像JSON
karate.log(karate.pretty(x))
除此之外,它不会使它成为无效的JSON
* def editJson =
"""
function(s)
{
var x = s.x
return x;
}
"""
* def p = call editJson ({"x" :abc})
* print p
# {"pratyush":'abc'}