#ref:java.util.LinkedHashMap error in Karate tool

Viewed 296
* def template1 = {"name1":"value1", "name2":"value2"}
* def template2 = template1

* Def jsontemplate = ({json1: template1, json2:template2})


* Print jsontemplate

Result :

  "json1": {
"name1": "value1",
"name2": "value2"
},
  "json2": "#ref:java.util.LinkedHashMap"
}

I am confused on how to overcome this issue. Can you help?

1 Answers

If you use * copy template2 = template1 instead of * def template2 = template1, then print will give you:

{  "json1": {
    "name1": "value1",
    "name2": "value2"
    },
  "json2": {
    "name1": "value1",
    "name2": "value2"
    }
} 
Related