-
Notifications
You must be signed in to change notification settings - Fork 499
Features_cn
温绍锦 edited this page May 9, 2022
·
7 revisions
在fastjson 2.x中,有两个Feature,分别用来配置序列化和反序列化的行为
- JSONWriter.Feature 配置序列化的行为
- JSONReader.Feature 配置反序列化的行为
Bean bean = ...;
JSON.toJSONString(bean, JSONWriter.Feature.WriteNulls); // 输出对象中值为null的字段
String jsonStr = ...;
JSON.parseObject(jsonStr, JSONReader.Feature.UseBigDecimalForDoubles); // 将小数数值读取为double