I have following JSON
{
"known-name": "Zevs",
"approximate-age": 320
}
And binding class
public class GodBinding {
@JsonProperty("known-name")
public String name;
@JsonProperty("approximate-age")
public int age;
// constructors
// getters & setters
}
And followng maven dependencies 2.23.2 2.5.4
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>${jersey.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
If I post such json then I have unexpected result with null's.
GodBinding [name=null, age=0]
If I use @JsonProperty without names and send JSON where property names equal field names
{
"name": "Zevs",
"age": 320
}
then it's working fine
GodBinding [name=Zevs, age=320]
If somebody know, how to make @JsonProperty("name") on fields working correctly?