无法从java.util.ArrayList
令牌中反序列化START_OBJECT
的实例:
at [Source: java.io.StringReader@3f680180; line: 1, column: 24966] (through reference chain: com.example.warrantycompass.model.AllProductsResponse["result"]->com.example.warrantycompass.model.Categories["Categories"]->java.util.ArrayList[2]->com.example.warrantycompass.model.ProductCategory["subcategories"])
Json回复:
AllProductsResponse
:
package com.example.warrantycompass.model;
import java.util.ArrayList;
import java.util.HashMap;
import android.os.Parcel;
import android.os.Parcelable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ProductSubcategory implements Parcelable {
@JsonProperty("id")
private int id;
@JsonProperty("name")
private String name;
@JsonProperty("image")
private String image;
@JsonProperty("Products")
private ArrayList<Object> products;
@JsonProperty("_id")
private int _id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public ArrayList<Object> getProducts() {
return products;
}
public void setProducts(ArrayList<Object> products) {
this.products = products;
}
public int get_id() {
return _id;
}
public void set_id(int _id) {
this._id = _id;
}
@Override
public int describeContents() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
dest.writeString(name);
dest.writeString(image);
dest.writeSerializable(products);
dest.writeInt(_id);
}
public static final Parcelable.Creator<ProductSubcategory> CREATOR = new Parcelable.Creator<ProductSubcategory>() {
public ProductSubcategory createFromParcel(Parcel in) {
return new ProductSubcategory(in);
}
public ProductSubcategory[] newArray(int size) {
return new ProductSubcategory[size];
}
};
public ProductSubcategory() {
}
@JsonIgnore
public ProductSubcategory(Parcel in) {
id = in.readInt();
name = in.readString();
image = in.readString();
products = (ArrayList<Object>) in.readSerializable();
_id = in.readInt();
}
}