I am trying to use Jackson annotations to rename some json shortcuts created during serialization. The annotations all compile fine, and when I run, Jackson serialization works, except that Jackson annotations are completely ignored. Even basic ones like @JsonIgnore or @JsonProperty do not affect json's response. The libraries that I have in my build path:
jsr311-qpi-1.1.1.jar jackson-[core|databind|annotations]-2.2.0.jar
I work in Eclipse, launching an external berth program with setting up an external program as:
Location: .../apache-maven-2.2.1/bin/mvnDebug.bat working Directory: ${workspace_loc:/ohma-rest-svr} Arguments: jetty:run
with the configuration of the remote Java application installed as:
Host: localhost Port: 8000
Without error messages that you can work with, I will lose a little things to try. Any ideas would be appreciated.
Here are some code examples from the class that 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; }
source share