Hey, I've been trying to serialize and deserialize a HashMap<integer,integer> that has one entry (1,1). but the entry seems to vanish after the serialization and deserialization. this is my code, it returns "true, false":</integer,integer>
So this is a limitation of JSON standard. JSON standard only allows for strings in the key of objects. So you're creating a Map<integer,integer> which is effectively getting converted to Map<string,integer>. When that is deserialized you're getting a Map<string,integer> which you try to look up a Integer value of 1 which isn't there. If you looked up "1" you'd find your Integer 1 value.</string,integer></string,integer></integer,integer>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey, I've been trying to serialize and deserialize a HashMap<integer,integer> that has one entry (1,1). but the entry seems to vanish after the serialization and deserialization. this is my code, it returns "true, false":</integer,integer>
Thanks! :)
So this is a limitation of JSON standard. JSON standard only allows for strings in the key of objects. So you're creating a Map<integer,integer> which is effectively getting converted to Map<string,integer>. When that is deserialized you're getting a Map<string,integer> which you try to look up a Integer value of 1 which isn't there. If you looked up "1" you'd find your Integer 1 value.</string,integer></string,integer></integer,integer>