I have a user object that is sent to and from the server. When I send out the user object, I don’t want to send the hashed password to the client. So, I added @JsonIgnore
on the password property, but this also blocks it from being deserialized into the password that makes it hard to sign up users when they don’t have a password.
How can I only get @JsonIgnore
to apply to serialization and not deserialization? I’m using Spring JSONView, so I don’t have a ton of control over the ObjectMapper
.
Things I’ve tried:
- Add
@JsonIgnore
to the property - Add
@JsonIgnore
on the getter method only