[英]Changing specific field values before Jackson serialization
Jackson Deserializer has the @JacksonInject annotation to change value before it is deserialized, overriding the original value. Jackson Deserializer具有@JacksonInject批注,可以在反序列化之前更改值,从而覆盖原始值。 Is there a way to do that during serialization?
有没有办法在序列化期间做到这一点?
@JsonView annotation helps with dropping specific fields altogether. @JsonView注释有助于完全删除特定字段。
The usecase is before a call is made to a REST api, Jackson should override specific sensitive field values ( which ever is annotated ) with a special character ( like * etc) 用例是在调用REST api之前,Jackson应该使用特殊字符(如*等)覆盖特定的敏感字段值(已注释)。
@JsonProperty
private String name = "Leghrib Badreddine";
@JsonValue
public String toJson(){
return "Mr." + this.name;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.