i have an class with the following annotations:
class A {
public Map> references;
@JsonProperty
public Map
You have to make sure there is @JsonIgnore annotation on the field level as well as on the setter, and getter annotated with @JsonProperty.
public class Echo {
@Null
@JsonIgnore
private String doNotDeserialise;
private String echo;
@JsonProperty
public String getDoNotDeserialise() {
return doNotDeserialise;
}
@JsonIgnore
public void setDoNotDeserialise(String doNotDeserialise) {
this.doNotDeserialise = doNotDeserialise;
}
public String getEcho() {
return echo;
}
public void setEcho(String echo) {
this.echo = echo;
}
}
@Controller
public class EchoController {
@ResponseBody
@RequestMapping(value = "/echo", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE)
public Echo echo(@RequestBody @Valid Echo echo) {
if (StringUtils.isEmpty(echo.getDoNotDeserialise())) {
echo.setDoNotDeserialise("Value is set by the server, not by the client!");
}
return echo;
}
}