0
問題是我收到此錯誤。無法將SaleListDTO的實例反序列化爲START_ARRAY令牌
我必須模擬剩餘服務調用,因爲它現在正由另一個團隊開發。
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.egencia.service.invoiceaggregator.cache.SaleListDTO out of START_ARRAY token
這裏是我的傑克遜映射豆
Jackson2ObjectMapperBuilder
.json()
.featuresToEnable(DeserializationFeature.UNWRAP_ROOT_VALUE, DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT) .serializationInclusion(JsonInclude.Include.NON_NULL)
.serializationInclusion(JsonInclude.Include.NON_EMPTY)
.failOnUnknownProperties(false)
.build();
@JsonRootName("list")
public class SaleListDTO {
private SaleDTO[] list;
public SaleDTO[] getList() {
return list;
}
public void setList(SaleDTO[] list) {
this.list = list;
}
}
這裏是JSON文件
{"list": [
{
"id": 111111,
"currency": "EUR",
"country": "ITA",
"name": "Italy",
"code": "IT"
},...
]}
我已經測試了這麼多的組合,但不成功。請幫忙
嗨@Barath,從哪個庫你服用的註解? – Sofiane
這是從項目的龍目島 – Sofiane