0
在Expedia的联盟网络,的API的下方的响应的一部分中的一个被返回作为阵列的几个项目,而对象对他人的响应被返回作为要么START_OBJECT或START_ARRAY,无法解析对象在
"Surcharges": {
"Surcharge": {
"_type": "TaxAndServiceFee",
"_amount": "11.94"
},
"_size": "1"
}
"Surcharges": {
"Surcharge": [
{
"_type": "TaxAndServiceFee",
"_amount": "11.94"
},
{
"_type": "Somethingelse",
"_amount": "11.94"
}
],
"_size": "1"
}
相应JAXB模型是
@JsonPropertyOrder({
"@size",
"Surcharge"
})
@JsonIgnoreProperties(ignoreUnknown = true)
public class Surcharges {
@JsonProperty("@size")
private String Size;
@JsonProperty("Surcharge")
private Surcharge[] Surcharge;
//was not part of the original model, added hoping this might solve :(
@JsonProperty("Surcharge")
private Surcharge Surcharge1;
.....
}
解析失败与
com.sun.jersey.api.client.ClientHandlerException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of in.xxx.xxxxx.port.adapter.expedia.hotels.list.response.Surcharge out of START_ARRAY token
和更改附加费阵列将导致
com.sun.jersey.api.client.ClientHandlerException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of in.xxx.xxxxxx.port.adapter.expedia.hotels.list.response.Surcharge out of START_OBJECT token
什么是处理这个响应
我能找到在杰克逊功能配置
ACCEPT_SINGLE_VALUE_AS_ARRAY解决方案的最佳方式,如何设置与泽西的ClientConfig?