-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #500: Serialization of a Map fails if the key uses a custom Serializer #501
Conversation
Hi! Any news about this? Do you see it OK? |
Hi @rmartinc , |
@Verdent If you have time to check this one too, it would be much appreciated! 😉 |
Something new about this PR? We are also interested in this one... Thanks in advance! |
@rmartinc Currently reviewing it :-) Btw could you please send me an email? I would like to discuss with you some unrelated stuff. I have mine mentioned in the profile. |
String json = jsonb.toJson(mapObject); | ||
MapObjectLocaleString resObject = jsonb.fromJson(json, MapObjectLocaleString.class); | ||
assertEquals(mapObject, resObject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might ask you to make "expected" String, which will contain the expected format produced json. The reason for that is, when you serialize object it can produce json which is deserializable back just fine, but it might not be the expected format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I have also read the json string as a JsonObject and checked all the "values" array is as expected. Regards!
…a custom Serializer Signed-off-by: rmartinc <[email protected]>
…a custom Serializer (eclipse-ee4j#501) Signed-off-by: rmartinc <[email protected]>
…ializer (#501) (#521) Signed-off-by: rmartinc <[email protected]>
Issue: #500
As commented in the issue the PR just adds two methods to
MapSerializer
(serializeKey
andserializeValue
) that should be called previously to serialize the map keys or values. The method is just used to change the index of the type (key=0 or value=1).Added a new test inside the
MapToEntriesArraySerializerTest.java
. All the needed classes have been added as inner ones inside the same class. If you prefer to move them to the model package just let me know.Any improvement will be welcomed. 😃
The idea is preparing another PR for 1.x branch when this one is ready.
Thanks in advance!