4

Is there any way to serialize BigInteger field in plain format as String JavaScript object field, rather than Numeric in exponential notation (which is default behavior of Jackson)?

Ivan Sharamet
  • 307
  • 4
  • 14

1 Answers1

3

You could use a specific serializer defined with JsonSerialize annotation

http://jackson.codehaus.org/1.2.1/javadoc/org/codehaus/jackson/map/annotate/JsonSerialize.html

The problem is similar to this question:

Java to Jackson JSON serialization: Money fields

Community
  • 1
  • 1
NCH
  • 111
  • 3
  • 1
    This solution is good in case you know the property type in compile time. In my case, I have a generic class that in some cases, one of its properties might be a BigInt and I want it to be serialized as a string. My question is, how do I replace the default BigInt serializer with one of my own? (the generic type might be a List for example) – Modi Aug 13 '13 at 08:31