I'm trying to use Jackson annotations to re-name some of the json labels produced during serialization. The annotations all compile fine, and when I run, the Jackson serialization works except all Jackson annotations are completely ignored. Even the basic ones like @JsonIgnore or @JsonProperty have no effect on the json response. The libraries I have in my build path are:
jsr311-qpi-1.1.1.jar
jackson-[core|databind|annotations]-2.2.0.jar
I'm running within Eclipse running the jetty external program with the External program setup as:
Location: .../apache-maven-2.2.1/bin/mvnDebug.bat
working Directory: ${workspace_loc:/ohma-rest-svr}
Arguments: jetty:run
with the Remote Java Application configuration set as:
Host: localhost
Port: 8000
With no error messages to work from, I'm at a bit of a loss of things to try. Any ideas would be appreciated.
Here's a bit of code sample from a class I need to serialize:
@XmlRootElement(name="ads-parameter")
public class DefineParameterResponse {
private Date _createdAt = new Date();
@JsonProperty("created-at")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd,HH:00", timezone="CET")
@XmlElement
public String getCreatedAt() {
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(_createdAt);
}
@JsonProperty("created-at")
public void setCreatedAt(Date createdAt) {
this._createdAt = createdAt;
}
private String _dataTitle1 = "Default Title1";
@XmlElement
@JsonProperty("data-title-1")
public String getDataTitle1() {
return _dataTitle1;
}
@JsonProperty("data-title-1")
public void setDataTitle1(String dataTitle1) {
this._dataTitle1 = dataTitle1;
}
@XmlElement
@JsonProperty("data-title-2")
public String getDataTitle2() {
return _dataTitle2;
}
@JsonProperty("data-title-2")
public void setDataTitle2(String dataTitle2) {
this._dataTitle2 = dataTitle2;
}