jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Default serialisation for BigInteger should be as a JSON String

Open Woodz opened this issue 6 years ago • 16 comments

I am aware of the ability to configure Jackson to serialize BigInteger as a JSON String (https://github.com/FasterXML/jackson-databind/issues/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

Woodz avatar Oct 23 '19 08:10 Woodz