我有一个这样的json:
[{"campaignName":"2012 Q1","id":1,"source":"Added by subject","status":"Draft","subject":"Test Subject1"},{"campaignName":"2012 Q2","id":2,"source":"Added by reviewer","status":"Created","subject":"Test Subject2"},{"campaignName":"2012 Q2","id":3,"source":"Added by reviewer","status":"Created","subject":"Test Subject62"}]
我有课:
public class Json_ToDoData {
private ArrayList<ToDo> mList;
public Json_ToDoData() {
}
public ArrayList<ToDo> getmList() {
return mList;
}
public void setmList(ArrayList<ToDo> mList) {
this.mList = mList;
}
}
和: `public class ToDo { public ToDo() { }
@SerializedName("campaignName")
private String campaignName;
@SerializedName("id")
private String id;
@SerializedName("source")
private String source;
@SerializedName("status")
private String status;
@SerializedName("subject")
private String subject; ... gettes and settes ...}`
我总是得到一个例外:
10-08 15:17:46.600: W/System.err(2557): java.lang.ClassCastException: java.util.ArrayList 我不明白为什么。这是我要解析的行:
Json_ToDoData rr = new JSONDeserializer<Json_ToDoData>().deserialize(sb.toString(), Json_ToDoData.class);
请帮帮我,谢谢