Java 在resteasy api中发送响应时忽略json变量
我想忽略json响应中的空值变量。 尝试使用fasterxmlJava 在resteasy api中发送响应时忽略json变量,java,resteasy,Java,Resteasy,我想忽略json响应中的空值变量。 尝试使用fasterxml @JsonSerialize(include = Inclusion.NON_NULL) @JsonProperty("response_value") private String response_value = null; 也 不工作。 是否有其他解决方案???您可以尝试直接配置ObjectMapper实例:mapper.setSerializationInclusion(Include.NON_NULL)确保您没有混合使用
@JsonSerialize(include = Inclusion.NON_NULL)
@JsonProperty("response_value")
private String response_value = null;
也
不工作。
是否有其他解决方案???您可以尝试直接配置
ObjectMapper
实例:mapper.setSerializationInclusion(Include.NON_NULL)代码>确保您没有混合使用Jackson v1和v2,因为它们忽略了彼此的注释。那么,您确定Jackson正在进行JSON序列化吗?也许RESTEasy还在这么做?
@JsonInclude(Include.NON_NULL)
@JsonProperty("response_value")
private String response_value = null;