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
I am aware of the ability to configure Jackson to serialize BigInteger as a JSON String (#1911) but I believe that it should be the default behaviour, with serialisation as a JSON Number configurable if required. The reason I believe this is that JSON Number does not have arbitrary length, which will lead to loss of precision during serialisation.
I disagree: I think number should be treated as number, unless configured to be serialized as JSON String (either globally or on per-field basis; both of which are possible). I think same is true for BigDecimal as well.
This both from conceptual (what I think is Right) and practical (change would be major backwards incompatible breakage leading to dozens of bug reports that I would then need to address).
In fact, I do not think there is much anything I can think of to suggest that such a change would be good thing.
I am aware of the ability to configure Jackson to serialize BigInteger as a JSON String (#1911) but I believe that it should be the default behaviour, with serialisation as a JSON Number configurable if required. The reason I believe this is that JSON Number does not have arbitrary length, which will lead to loss of precision during serialisation.
Supporting evidence:
https://stackoverflow.com/a/39681707/323177
https://stackoverflow.com/a/38357877/323177
https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues
The text was updated successfully, but these errors were encountered: