我正在使用 Jackson 库来解析本地 json 文件。当按下解析按钮时,我有这个错误:
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();
}
有什么要在代码中添加的吗?难道我做错了什么?谢谢你的帮助。