Skip to content

Instantly share code, notes, and snippets.

@stoicflame
Created October 13, 2011 18:49
Show Gist options
  • Save stoicflame/1285114 to your computer and use it in GitHub Desktop.
Save stoicflame/1285114 to your computer and use it in GitHub Desktop.
Custom JSON Jackson Properties
public class User {
private Date dtBirth;
@JsonIgnore
public Date getDtBirth() { return dtBirth; }
@JsonIgnore
public void setDtBirth(Date dtBirth) { this.dtBirth = dtBirth; }
@JsonProperty("dtBirth")
@JsonName("dtBirth") //tell enunciate what the name of the json property is because enunciate doesn't yet recognize jackson annotations.
public String getDtBirthAsString() { ... }
@JsonProperty("dtBirth")
public void setDtBirthAsString(String dtBirth) {...}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment