Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Karate #参考:空手道工具中的java.util.LinkedHashMap错误_Karate - Fatal编程技术网

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"
    }
}