我正在尝试转换以下json:
[
{
"title": "1411635467882",
"price": {
"value": "1234",
"currency": "INR"
}
}
]
使用代码:
final JavaType type = this.objectMapper.getTypeFactory().constructCollectionType(List.class, Product.class);
return this.objectMapper.readValue(new File(filePath), type);
出现以下错误:
Can not set com.google.api.services.content.model.Price field com.google.api.services.content.model.Product.price to java.util.LinkedHashMap (through reference chain: com.google.api.services.content.model.Product["price"])
如果我用简单的pojo类替换Product和Price类。它工作正常,但它不适用于第三方提供的产品类别: https://developers.google.com/resources/api-libraries/documentation/content/v2/java/latest/com/google/api/services/content/model/Product.html