在最近的开发中,有接口需求,但是返回是json数据中有许多空值“”或null,利用fastjson轻松搞定。
加入fastjson的jar包后,
return com.alibaba.fastjson.JSONObject.toJSONString(this, true);
后面的参数true,会在网页上看起来很美观。
在最近的开发中,有接口需求,但是返回是json数据中有许多空值“”或null,利用fastjson轻松搞定。
加入fastjson的jar包后,
return com.alibaba.fastjson.JSONObject.toJSONString(this, true);
后面的参数true,会在网页上看起来很美观。