I have created a class Game that looks like this:
public class Game{
private String name;
private String location;
private int participants;
public Game(String name, String location, int participants){
this.name = name;
this.location = location;
this. participants = participatns;
}
//getters and setters of all properties
And I have a ArrayList that looks like this:
ArrayList<Game>gameList = new ArrayList<Game>();
This ArrayList contains 5 games. I want to send those games to a php script so I figured that the smartest way to do this is to create a JSON array of objects and send those to the php script because those games could also be a 100 or more at some point.
My question is, how do I create a JSON array of Game objects?