fastjson2 icon indicating copy to clipboard operation
fastjson2 copied to clipboard

[QUESTION] fastjson1.x 升级fastjson2.x,FastJsonConfig字段dateFormat默认值有调整,能否可通过开关调整默认值?

Open huisman6 opened this issue 4 months ago • 0 comments

请描述您的问题

FastJsonConfig 在fastjson1.x里,dateFormat默认值为null。

public class FastJsonConfig {
    private Charset charset;
    private String dateFormat;
 }

在2.x里默认值为 "yyyy-MM-dd HH:mm:ss"

public class FastJsonConfig {
    private Charset charset;
    private String dateFormat = "yyyy-MM-dd HH:mm:ss";
 }

目前我们在项目升级时,要求所有创建FastJsonConfig的地方使用统一的工具类创建,工具类里显式设置了dateFormat为null。

建议fastjson2.x里可以提供选项保持和1.x的默认一致。

huisman6 avatar Aug 15 '25 02:08 huisman6