JsonProperty
isn\'t overriding the default name jackson gets from the getter. If I serialize the class below with ObjectMapper
and jackson I get
Have you tried below
class JacksonTester {
private String hi;
@JsonProperty("hello")
public String getHi() {
return hi;
}
}
I mean making the 'hi' variable declaration as private. Alternatively try to put a @JsonIgnore on the variable declaration and in case you would rather keep it at default scope.