In my entity class, I\'m trying to make a write-only field (gets ignored during serialization, but gets de-serialized normally).
@JsonProperty
@JsonSerialize
You can set access
value:
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String password;
Use @JsonIgnore on just the getter getPassword
, instead of using the NullSerializer
. Then also use @JsonProperty("password")
on the setter.
This should allow password
to be de-serialized, but the JSON output of serialization won't include it.
For example, a "getter" method that would otherwise denote a property (like, say, "getValue" to suggest property "value") to serialize, would be ignored and no such property would be output unless another annotation defines alternative method to use.