0
我正在使用Jackson库来解析本地json文件。 当解析按钮按下我有错误:无法反序列化ArrayList
W/System.err(7569): org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_NUMBER_INT token
JSON文件是:
{"surveys":[{"id_survey":"1","question_survey":"Are you happy with the actual government?","answer_yes":"50","answer_no":"20"}],"success":1}
,使检索的方法是:
final void gettingJson() {
final Thread checkUpdate = new Thread() {
public void run() {
usersController.init();
final StringBuilder str = new StringBuilder("user : ");
for (User u : usersController.findAll()) {
str.append("\n").append("ID : ").append(u.getId_survey());
str.append("\n").append("Question : ").append(u.getQuestion_survey());
str.append("\n").append("Yes : ").append(u.getAnswer_yes());
str.append("\n").append("No : ").append(u.getAnswer_no());
}
runOnUiThread(new Runnable() {
public void run() {
displayJson.setText(str.toString());
}
});
}
};
checkUpdate.start();
}
有什么补充在代码中?难道我做错了什么? 谢谢你的帮助。
如果没有匹配类定义,您的问题将不会被回答:所有可以说的是,所讨论的类期望一个'List',但JSON包含一个数字。 – StaxMan