When SerializerFeature.WriteNullStringAsEmpty
given in JSON.toJSONString, SerializerFeature.WriteMapNullValue
in @JSONField
does not work.
public class TestJson {
@JSONField(serialzeFeatures=SerializerFeature.WriteMapNullValue)
public String getValue() {
return null;
}
public static void main(String[] args) throws Exception {
System.out.println(JSON.toJSONString(new TestJson(), SerializerFeature.WriteNullStringAsEmpty));
}
}
Expects {"value":null}
but actually gets {"value":""}
.
Version: 1.2.63_preview_01
Jackson alaways use @JsonInclude
or @JsonSerialize
on fields/methods prior to ObjectMapper
settings.
暂无答案!
目前还没有任何答案,快来回答吧!