解决fastjson将序列化null值字段丢失
fastjson1:
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
// 设置 SerializerFeature 中的 WriteMapNullValue 参数
String jsonString = JSON.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue)
fastjson2:
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSONWriter;
String jsonString = JSON.toJSONString(jsonObject, JSONWriter.Feature.WriteMapNullValue, JSONWriter.Feature.WriteNullListAsEmpty);