I\'m trying to create some Java objects using this line:
Quiz currentQuiz = gson.fromJson(json, Quiz.class);
But the all I get is this:
Try this...
JSONObject js = new JSONObject(jsonString);
for (int i = 0; i < js.length(); i++) {
JSONObject quiz = js.getJSONObject("quiz");
for (int j = 0; j < js.length(); j++) {
String broadcast_dt = quiz.getString("broadcast_dt");
String ref = quiz.getString("ref");
JSONArray questions = quiz.getJSONArray("questions");
for (int k = 0; k < questions.length(); k++) {
String value = questions.getString(k);
JSONObject quest = new JSONObject(questions.getString(k));
int question_number = quest.getInt("question_number");
String question_text = quest.getString("question_text");
JSONArray answers = quest.getJSONArray("answers");
for (int m = 0; m < answers.length(); m++) {
JSONObject ans = new JSONObject(answers.getString(m));
Boolean correct_yn = ans.getBoolean("correct_yn");
String answer_text = ans.getString("answer_text");
}
}
}
}