I am trying to turn a JSON
where there is an array of objects for each object 4 properties: question, answer 1, answer 2, answer 3, correct answer.
I created a Class
called Question.
I want to create an array
/ list
of Question and then use it
The JSON is located in the assets folder named: questions.json
public class Question{
private String title;
private String a1, a2, a3;
private String cA;
public Question(String title, String a1, String a2, String a3, String cA){
this.title = title;
this.a1 = a1;
this.a2 = a2;
this.a3 = a3;
this.cA = cA;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getA1() {
return a1;
}
public void setA1(String a1) {
this.a1 = a1;
}
public String getA2() {
return a2;
}
public void setA2(String a2) {
this.a2 = a2;
}
public String getA3() {
return a3;
}
public void setA3(String a3) {
this.a3 = a3;
}
public String getcA() {
return cA;
}
public void setcA(String cA) {
this.cA = cA;
}
}
question from:
https://stackoverflow.com/questions/65920382/how-to-convert-json-file-to-list 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…