저는 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