create a JSON Array of objects in java android -


i have created class game looks 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 , setters of properties 

and have arraylist looks this:

 arraylist<game>gamelist = new arraylist<game>(); 

this arraylist contains 5 games. want send games php script figured smartest way create json array of objects , send php script because games 100 or more @ point.

my question is, how create json array of game objects?

the best thing gson. gson web site,

public class exampleobject {     public static final string api_key = "get_response";     private static final string offsets = "offsets";      @serializedname(offsets)     private list<integer> moffsets;        public exampleobject() {         super();     }      public string getapikey() {         return api_key;     }      public list<integer> getoffsets() {         return moffsets;     } } 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -