3
我有一個一流的,我有一個自定義解串器註釋:如何在端點類上實現自定義@JsonDeserialize方法?
@JsonDeserialize(using = ConvertToNullDeserializer.class)
public void setObject(Integer pObj) {
this.pObj = pObj;
}
當這個對象是通過AJAX發送到雲終端,我想自定義deserailizer火,而是我只是得到:
{
"error" : {
"message" : "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.lang.Integer from String value 'null': not a valid Integer value\n at [Source: N/A; line: -1, column: -1] (through reference chain:
"code" : 400,
"errors" : [ {
"domain" : "global",
"reason" : "badRequest",
"message" : "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.lang.Integer from String value 'null': not a valid Integer value\n at [Source: N/A; line: -1, column: -1] (through reference chain:
} ]
}
}
謝謝!
我不知道我完全理解你的問題,雲終端一般需要照顧的序列化和反序列化的你。也許@JsonDeserialize註釋不是你想要的路徑,因爲通過端點你可以將json相關的東西委託給系統。你的解串器做什麼? – loosebazooka