| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.alibaba.fastjson2.JSONWriter; |
| | | import com.alibaba.fastjson2.TypeReference; |
| | | import com.xz.framework.core.agent.IJsonSerializerAdapter; |
| | | |
| | |
| | | |
| | | @Override |
| | | public String serialize(Object entity) { |
| | | return JSON.toJSONString(entity); |
| | | // if (!isProd) { |
| | | // return JSON.toJSONString(entity, serializeConfig, SerializerFeature.WriteMapNullValue, SerializerFeature.PrettyFormat); |
| | | // } |
| | | // return JSON.toJSONString(entity, serializeConfig, SerializerFeature.WriteMapNullValue); |
| | | if (!isProd) { |
| | | return JSON.toJSONString(entity, JSONWriter.Feature.WriteMapNullValue, JSONWriter.Feature.PrettyFormat); |
| | | } |
| | | return JSON.toJSONString(entity, JSONWriter.Feature.WriteMapNullValue); |
| | | } |
| | | |
| | | @Override |
| | | public String serialize(Object entity, boolean notNull) { |
| | | return JSON.toJSONString(entity); |
| | | // if (!isProd) { |
| | | // if (notNull) { |
| | | // return JSON.toJSONString(entity, serializeConfig, SerializerFeature.PrettyFormat); |
| | | // } |
| | | // return JSON.toJSONString(entity, serializeConfig, SerializerFeature.WriteMapNullValue, SerializerFeature.PrettyFormat); |
| | | // } |
| | | // if (notNull) { |
| | | // return JSON.toJSONString(entity, serializeConfig, SerializerFeature.PrettyFormat); |
| | | // } |
| | | // return JSON.toJSONString(entity, serializeConfig, SerializerFeature.WriteMapNullValue); |
| | | if (!isProd) { |
| | | if (notNull) { |
| | | return JSON.toJSONString(entity, JSONWriter.Feature.PrettyFormat); |
| | | } |
| | | return JSON.toJSONString(entity, JSONWriter.Feature.WriteMapNullValue, JSONWriter.Feature.PrettyFormat); |
| | | } |
| | | if (notNull) { |
| | | return JSON.toJSONString(entity, JSONWriter.Feature.PrettyFormat); |
| | | } |
| | | return JSON.toJSONString(entity, JSONWriter.Feature.WriteMapNullValue); |
| | | } |
| | | |
| | | @Override |