我正在尝试解析以下JSON数组:
[{"desc": "A coffee-based beverage or dessert. Usually refers to the act of topping a drink or dessert with esp...", "image_url": "http://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Affogato.JPG/800px-Affogato.JPG", "id": "affogato", "name": "Affogato"}, {"desc": "A style of coffee prepared by adding hot water to espresso, giving a similar strength to but differe...", "image_url": "", "id": "americano", "name": "Caffe Americano"}]
我的java代码:
@JsonIgnoreProperties(ignoreUnknown = true)
public class CoffeeList extends ArrayList<Coffee> {
public CoffeeList() {
}
}
@Override
public CoffeeList loadDataFromNetwork() throws Exception {
return getRestTemplate().getForObject(baseUrl, CoffeeList.class);
}
结果:
java.lang.NullPointerException
“在调用Web服务期间发生异常。”
我做什么?