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?