<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Deserialization of Map with reference value</title><link>https://answers.axonivy.com/questions/4242/deserialization-of-map-with-reference-value</link><description>&lt;p&gt;Dear Ivy team, 
I face an issue when using Map&amp;lt;String, Object&amp;gt;.
I have two key, there has the same value, then it serializes like it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{
  "additionalData": {
    "@class": "Class&amp;amp;lt;java.util.HashMap&amp;amp;gt;",
    "firstKey": {
      "@class": "Class&amp;amp;lt;objecttype.Assignee&amp;amp;gt;",
      "@id": "$Ref-1",
      "displayName": "Hen"
    },
    "secondKey": "$Ref-1"
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And when deserializes I expect it should be:&lt;br&gt;
&lt;b&gt;{firstKey=Assignee [displayName=Hen], secondKey=Assignee [displayName=Hen]}&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;But it actual:&lt;br&gt;
&lt;b&gt;{firstKey=Assignee [displayName=Hen], secondKey=$Ref-1}&lt;/b&gt;&lt;br&gt;
The second key now map with wrong value.&lt;/p&gt;
&lt;p&gt;Is there any way to overcome this issue?
Thanks a lot!&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/4242/deserialization-of-map-with-reference-value" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 06 Dec 2019 05:14:08 -0500</lastBuildDate><item><title>Answer by Lukas Lieb</title><link>https://answers.axonivy.com/questions/4242/deserialization-of-map-with-reference-value/4253</link><description>&lt;p&gt;Hm... It seems that this is a bug in our deserialization code. Is working if you serialize a Map&amp;lt;string, assignee=""&amp;gt; but not with abstract classes. I will create an issue for this.
A roundtrip to "solve" it for now could be to create 2 objects and don't save the same object.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Lukas Lieb</dc:creator><pubDate>Fri, 06 Dec 2019 05:14:08 -0500</pubDate><guid>https://answers.axonivy.com/questions/4242/deserialization-of-map-with-reference-value/4253</guid></item></channel></rss>