使用Jackson将BigInteger字段序列化为String(以简单表示法)

时间:2021-01-26 16:52:57

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)?

有没有办法以普通格式将BigInteger字段序列化为String JavaScript对象字段,而不是指数表示法中的数字(这是Jackson的默认行为)?

1 个解决方案

#1


3  

You could use a specific serializer defined with JsonSerialize annotation

您可以使用使用JsonSerialize注释定义的特定序列化程序

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

Java to Jackson JSON序列化:Money字段

#1


3  

You could use a specific serializer defined with JsonSerialize annotation

您可以使用使用JsonSerialize注释定义的特定序列化程序

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

Java to Jackson JSON序列化:Money字段