JsonProperty
不会覆盖jackson从getter获得的默认名称.如果我用ObjectMapper
和jackson序列化下面的类
{"hi":"hello"}
正如您所见,JsonProperty注释没有效果
class JacksonTester {
String hi;
@JsonProperty("hello")
public String getHi() {
return hi;
}
}
Putting @JsonProperty
on the String itself doesn't work either. The only way it seems that I can change the name is by renaming the getter, the only problem is that it then will always be lowercase for the first letter