How to map JSON field names to different object field names?
Solution 1:
Probably it's a bit late but anyway..
you can rename a property just adding
@JsonProperty("contractor")
And by default Jackson use the getter and setter to serialize and deserialize.
For more detailed information: http://wiki.fasterxml.com/JacksonFAQ
Solution 2:
With some example, You can also use it in getter and setter to rename it to different field
public class Sample {
private String fruit;
@JsonProperty("get_apple")
public void setFruit(String fruit) {
this.fruit = fruit;
}
@JsonProperty("send_apple")
public String getFruit() {
return fruit;
}
}