public String formatJson(Object obj) {

    	com.alibaba.fastjson.JSONObject json=(com.alibaba.fastjson.JSONObject)JSON.toJSON(obj);
	    //定制序列化
	    SerializeFilter[] filter = new SerializeFilter[]{
	        new ValueFilter() {
	            @Override
	            public Object process(Object object, String name, Object value) {
	                if (value == null || value == "") {
	                    return "";
	                }
	                return value;
	            }
	        }
	    };
	    return JSON.toJSONString(json, filter, SerializerFeature.WriteMapNullValue,
	        SerializerFeature.WriteNullStringAsEmpty,
	        SerializerFeature.WriteNullListAsEmpty,
	        SerializerFeature.WriteDateUseDateFormat);
    }

  

相关文章:

  • 2022-01-29
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2021-10-24
  • 2021-09-28
猜你喜欢
  • 2021-06-29
  • 2021-10-25
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案