对象转JSONObject——字段空值不显示处理办法

一、引包


    com.alibaba
    fastjson
    1.2.71

二、使用toJSONString()

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;

String s = JSONObject.toJSONString(对象,SerializerFeature.WriteMapNullValue);

你可能感兴趣的:(对象转JSONObject——字段空值不显示处理办法)