java - GSON nameless array -


i have json data looks this:

[["rank", "team", "qual avg", "auto", "container", "coopertition", "litter", "tote", "played"],  ["1", "1225", "60.8", "0", "224", "80", "70", "240", "10"],  ["2", "3506", "55.2", "0", "132", "40", "268", "118", "10"],  ["3", "5511", "53.3", "4", "124", "160", "141", "134", "10"],  ["4", "3336", "51.7", "0", "80", "160", "177", "100", "10"],  ["5", "4073", "49.1", "0", "100", "80", "167", "156", "10"]] 

i've been using gson library parse other json data no problem since these arrays no names. i'm not sure how make model since there no names on anything. fetching script works this. i'm sure there simple missing couldn't find in documentation help.

public class eventparsers {     public string tag = "eventparsers";     public volatile boolean parsingcomplete = true;     private events[] events;     private arraylist<events> eventarray = new arraylist<>();      public void fetchjson(final string number) {         thread thread = new thread(new runnable() {             @override             public void run() {                 try {                     gson gson = new gson();                     bluealliance bluealliance = new bluealliance();                     bufferedreader reader = new bufferedreader(new inputstreamreader(bluealliance                             .connect(constants.geteventurl(number))));                     events = gson.fromjson(reader, events[].class);                     eventarray = new arraylist<>(arrays.aslist(events));                     bluealliance.close();                     log.i(tag, "url: " + constants.geteventurl(number));                     parsingcomplete = false;                 } catch (exception e) {                     e.printstacktrace();                 }             }         });         thread.start();     }      public arraylist<events> getevents() {         return eventarray;     } } 

actually have array of arrays of strings, need

events = gson.fromjson(reader, string[][].class); 

Comments