1. 程式人生 > >Jackson錯誤:Can not deserialize instance of java.lang.String out of START_OBJECT token

Jackson錯誤:Can not deserialize instance of java.lang.String out of START_OBJECT token

類型 fse ken eof mod 服務 app star put

org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: org.apache.http.conn.EofSensorInputStream@42b0f150; line: 1, column: 112] (through reference chain: com.webservice.net.model.GetAffairNewsListResponse["list"]->com.webservice.net.model.AffairNewsList["publishTime"]); 

nested exception is org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token

 at [Source: org.apache.http.conn.EofSensorInputStream@42b0f150; line: 
1, column: 112] (through reference chain: com.webservice.net.model.GetAffairNewsListResponse["list"]->com.webservice.net.model.AffairNewsList["publishTime"])

遇到這樣的錯誤,主要是服務器數據和客戶端數據類型不一致,這裏遇到的publishTime數據類型,服務器是datetime型,而我客戶端數據是String型,就會導致這樣的錯誤,調成一致即可。

Jackson錯誤:Can not deserialize instance of java.lang.String out of START_OBJECT token