前言:在生产中出现一个问题,就是BigDecimal类型的字段在前端页面展示变成科学计数法,通过排查,发现里面的坑还是挺多的,所以特意记录下处理过程。Json序列化,不同项目中配置的都不一样,有些项目是使用springboot里面自带的jackson的,有些是使用fastjson处理,不同的序列化的处理方式也不一样。 1、fastJson对BigDecimal序列化和反序列化 字段返回完整的数字,避免科学计数法 我们看下JSON.toJSONString()的方法,我们可以看到,可以传进SerializerFeature的枚举 public static String toJSONString(Object object, SerializerFeature...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with Type
Contact Type, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack