Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONField注解指定serialzeFeatures=SerializerFeature.WriteBigDecimalAsPlain不生效 #2355

Closed
yuruixin opened this issue Apr 3, 2019 · 1 comment

Comments

@yuruixin
Copy link

yuruixin commented Apr 3, 2019

fastjson版本 1.2.55

@JSONField(serialzeFeatures = SerializerFeature.WriteBigDecimalAsPlain)
 private BigDecimal num;

如上,在实体类的属性上加了JSONField注解,并指定serialzeFeatures=SerializerFeature.WriteBigDecimalAsPlain不生效
试图解决的问题:
当num的值为0.00000001时,默认toString后的值为科学计数法1e-8,业务需要展示为0.00000001

采用SON.toJSONString(bean, SerializerFeature.WriteBigDecimalAsPlain)可以达到出预期结果
采用@JSONField(serialzeFeatures = SerializerFeature.WriteBigDecimalAsPlain)及JSON.toJSONString(bean),无法达到预期效果

@AmuseBoy
Copy link

谢谢,这个蛋疼的fastjson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants