You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using polymorphic serialisation with @JsonTypeInfo, e.g. on a Collection of Objects, the type information is sent with the values to ensure correct deserialisation. Doubles (and others like Strings) don't get their types included given they are considered the default deserialisation type. This causes problems for Double.NaN, Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY as they get deserialised into strings rather than Double.
Would it make sense to include the type for these three Double values to ensure they can also be correctly deserialised (I tested that the deserialisation works correctly if the type is included in the data)?
(Using 2.9.8)
Thanks!
CBB
The text was updated successfully, but these errors were encountered:
Interesting edge case. Yes, that would indeed make sense.
Thank you for reporting the issue.
My main concern (without looking at code yet) is whether output as String is handled by serializer (if so, easy), or low-level JsonGenerator -- latter case would be difficult to handle cleanly wrt separation of responsibilities.
cowtowncoder
changed the title
Type not provided on Double NaN and Infinity with @JsonTypeInfo
Type id not provided on Double.NaN, Infinity with @JsonTypeInfoFeb 9, 2019
When using polymorphic serialisation with @JsonTypeInfo, e.g. on a Collection of Objects, the type information is sent with the values to ensure correct deserialisation. Doubles (and others like Strings) don't get their types included given they are considered the default deserialisation type. This causes problems for Double.NaN, Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY as they get deserialised into strings rather than Double.
Would it make sense to include the type for these three Double values to ensure they can also be correctly deserialised (I tested that the deserialisation works correctly if the type is included in the data)?
(Using 2.9.8)
Thanks!
CBB
The text was updated successfully, but these errors were encountered: