[英]How to ignore “null” or empty properties in json, globally, using Spring configuration
[英]How globally ignore Null Fields with restesy response?
我使用JBoss EAP 7.1和JAVA EE。 我可以在类all all @JsonInclude(JsonInclude.Include.NON_NULL)
下使用@JsonInclude(JsonInclude.Include.NON_NULL)
注释排除null字段。 是否存在排除全局(在所有项目中)空值的方法,这些空值在resteasy返回响应中返回,例如:
Response.status(Response.Status.OK).entity(objet).build()
您需要在应用中配置ObjectMapper
实例:
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
也可以看看:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.