I have a JSON Array which has for example following objects in it:
A Car and the Color of the car which is saved like
0:{Car: "Toyota", Color: "Blue"}
1:{Car: "Porsche", Color: "Black"}
2:{Car: "Ferrari", Color: "Red"}
I need to loop through that array in java and for every run, and make a Java Object out of the JSON objects (Cars in this case) in the array, something like
Test current = new Test(Car, Color)
and after that I want it to save in the java array like
data.add(current)
I already started to do a loop but I can't get further:
private List<Test> data;
private void setObjects() {
String newData = request.getParameter("data");
try {
JSONArray jsonarr = new JSONArray(Data);
System.out.println(jsonarr.toString());
}
}