0

I am trying to parse the following JSON array:

[{"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"}]

my java code:

@JsonIgnoreProperties(ignoreUnknown = true)
public class CoffeeList extends ArrayList<Coffee> {

    public CoffeeList() {
    }
}

@Override
public CoffeeList loadDataFromNetwork() throws Exception {
    return getRestTemplate().getForObject(baseUrl, CoffeeList.class);
}

RESULT:

java.lang.NullPointerException

"Exception occurred during invocation of web service."

What DO i do ?

rciovati
  • 27,603
  • 6
  • 82
  • 101
android_eng
  • 1,370
  • 3
  • 17
  • 40
  • Make sure your api getRestTemplate().getForObject(baseUrl, CoffeeList.class); is returning the CoffeeList. Also, Your tagging of your class CoffeeList.class is the same with your api response. – chkm8 Nov 21 '14 at 07:26
  • Could you please post the whole stacktrace? – rciovati Nov 23 '14 at 14:37

0 Answers0