0

我正在尝试解析以下 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 服务时发生异常。”

我该怎么办 ?

4

0 回答 0