Reputation: 21
I cannot find a way to fix this issue, but... maybe it's not an issue.
I use Extjs as the front-end and Spring MVC as backend, the Ajax request looks like:
{"isOk": true}
The Mapping DTO is:
public class TestDTO implements Serializable {
private static final long serialVersionUID = -6074462313103219627L;
private Boolean isOK;
public Boolean isOk(){...}
Public void setOk(Boolean isOk){...}
}
The get/set method be generated by intellij idea, as you can imagine that jackson works fine if I add @JsonProperty("isOk") under the "setOk" method.
But I have a lot of ***DTO objects, so is there a convenient method to reslove this issue? thanks.
I have checked the "com.fasterxml.jackson.databind.SerializationFeature" class, and didn't find any config which like the "compatible_boolean_and_ignore_is_keyword" etc..
Upvotes: 0
Views: 126
Reputation: 432
I didn't test it, but might be helpful for your case:
https://stackoverflow.com/a/35088196/677937
Basically, try to rename your getter/setter to:
getIsOk / setIsOk
It should then serialize/deserialize json in form of {"isOk": ... }
Upvotes: 1
Reputation: 149
It's been some time since I used spring, but if I recall correctly you have to
class DTO implements Serializable
)Upvotes: 0