Created
July 16, 2019 11:58
-
-
Save FusRoDah061/a719192b97688240d3c2c8c3e9fb4a7e to your computer and use it in GitHub Desktop.
SpringBoot Jackson JSON ignore property on deserialization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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