Karate #参考:空手道工具中的java.util.LinkedHashMap错误
结果:Karate #参考:空手道工具中的java.util.LinkedHashMap错误,karate,Karate,结果: * def template1 = {"name1":"value1", "name2":"value2"} * def template2 = template1 * Def jsontemplate = ({json1: template1, json2:template2}) * Print jsontemplate 我对如何克服这个问题感到困惑。您能帮忙吗?如果您使用*copy template2=template1而不是*def template2=template1,
* def template1 = {"name1":"value1", "name2":"value2"}
* def template2 = template1
* Def jsontemplate = ({json1: template1, json2:template2})
* Print jsontemplate
我对如何克服这个问题感到困惑。您能帮忙吗?如果您使用
*copy template2=template1
而不是*def template2=template1
,那么print
将为您提供:
"json1": {
"name1": "value1",
"name2": "value2"
},
"json2": "#ref:java.util.LinkedHashMap"
}
值得一提的是,`*match jsontemplate=={json1:'(template1'),json2:'(template1)}`有效。为什么要打印它?@AutomationTester空手道在打印树时非常聪明,因为它检测到无限递归:)在幕后,所有数据都正常。请将Alex J的回答标记为正确。
{ "json1": {
"name1": "value1",
"name2": "value2"
},
"json2": {
"name1": "value1",
"name2": "value2"
}
}