tags:

views:

101

answers:

0

Getting the following exception while deserializing an object:

com.google.gson.JsonParseException: The JsonDeserializer com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter@1e2befa failed to deserialized json object {"com.gsicommerce.analytics.platform.model.webstore.AnalyticsProduct":[{"id":"3680231","longTitle":"Graco SnugRide Infant Car Seat - Pippin","available":"true"}]} given the type com.google.gson.ParameterizedTypeImpl@b565dd

Here is the class that I am trying to deserialize:

public class TrusRegWishAddItemEvent implements Serializable {
static final long serialVersionUID = 1L;
private final List<AnalyticsProduct> items;

private TrusRegWishAddItemEvent() {
    items = null;
}

public TrusRegWishAddItemEvent(List<AnalyticsProduct> items) {
    this.items = items;
}

public List<AnalyticsProduct> getItems() {
    return items;
}      

}

public class AnalyticsProduct implements Serializable {
static final long serialVersionUID = 1L;
private final long id;
private final String longTitle;
private final boolean available;

public AnalyticsProduct() {
    id = 0;
    longTitle = null;
    available = false;
}

public AnalyticsProduct(long id, String longTitle, boolean available) {
    this.id = id;
    this.longTitle = longTitle;
    this.available = available;
}

public long getId() {
    return id;
}

public String getLongTitle() {
    return longTitle;
}

public boolean isAvailable() {
    return available;
}

}

Please guide.