Skip to content

Instantly share code, notes, and snippets.

@FusRoDah061
Created July 16, 2019 11:58
Show Gist options
  • Select an option

  • Save FusRoDah061/a719192b97688240d3c2c8c3e9fb4a7e to your computer and use it in GitHub Desktop.

Select an option

Save FusRoDah061/a719192b97688240d3c2c8c3e9fb4a7e to your computer and use it in GitHub Desktop.
SpringBoot Jackson JSON ignore property on deserialization
// https://stackoverflow.com/questions/12505141/only-using-jsonignore-during-serialization-but-not-deserialization
// Use @JsonIgnore on class member and its getter. Use @JsonProperty on its setter.
class User{
// More fields here
@JsonIgnore
private String password;
@JsonIgnore
public String getPassword() {
return password;
}
@JsonProperty
public void setPassword(String password) {
this.password = password;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment