package com.post;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONWriter;
import com.ruoyi.postCheck.domain.PostList;

import java.util.Date;

public class FastJsonFormat {
    public static void main(String[] args) {
        PostList data = new PostList();
        data.setId(111l);
        data.setDeptName("测试部门");
        data.setCreateTime(new Date());
//        JSONWriter.Context fratures = new JSONWriter.Context();
//        JSONWriter.Feature.PrettyFormat

        System.out.println(JSON.toJSONString(data,
                JSONWriter.Feature.PrettyFormat,
                JSONWriter.Feature.WriteMapNullValue
        ));

//        SerializerFeature

//                SerializerFeature.PrettyFormat  // 表示会换行输出(默认是一行)
//                    ,SerializerFeature.WriteMapNullValue  // 表示会输出空值(默认空值不序列化)
//                    ,SerializerFeature.WriteDateUseDateFormat  // 表示会格式化日期(默认是毫秒值)

    }
}
