50,527
社区成员
发帖
与我相关
我的任务
分享
objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>()
{
@Override
public void serialize(
Object value,
JsonGenerator jg,
SerializerProvider sp) throws IOException, JsonProcessingException
{
jg.writeString("");
}
});
@RequestMapping("/api/users/info")
public UserLoginResp userInfo(@RequestBody BaseReq req) throws BusinessException {
System.out.println(req.toString("/api/users/info"));
return userService.userInfo(req); <---这里就直接返回对象了.然后我就不知道了.直接返回json了,也不知道在哪配置的
}
UserLoginResp <---这里的这个对象就是一个一般的pojo
@JsonInclude(Include.NON_NULL)<--如果加了这玩意 就不序列化null的,但是我要null也序列化成""
public class UserLoginResp {