JSON转换日期格式化
JsonConfig jsonConfig = new JsonConfig(); jsonConfig.registerJsonValueProcessor(Date.class , new JsonDateValueProcessor("yyyy-MM-dd HH:mm:ss"));
FastJson使用技巧
JSON.toJSONString(object,SerializerFeature.WriteMapNullValue,SerializerFeature.WriteNullStringAsEmpty);
------全字段展示,包括为null的字段
JSONObject json = JSONObject.parseObject(JSON.toJSONString(object,SerializerFeature.WriteMapNullValue,SerializerFeature.WriteNullStringAsEmpty));
json.toString;
------这种写法会把为null字段过滤掉