android - GSON Deserialize JSON with no variable names -
i'm trying figure out how de-serialize in gson. here's have far...
i have klm file imported fusion table i'm able retrieve google , looks so:
{ "kind": "fusiontables#sqlresponse", "columns": [ "description", "name", "address", "geometry" ], "rows": [ [ "address: cape colony , commodore drive san jose, ca 95133", "berryessa community garden", "cape colony , commodore drive san jose, ca 95133", { "geometry": { "type": "point", "coordinates": [ -121.862809, 37.375257, 0.0 ] } } ], [ "address: s. 6th street , bestor street san jose, ca 95112", "bestor community garden", "s. 6th street , bestor street san jose, ca 95112", { "geometry": { "type": "point", "coordinates": [ -121.873797, 37.32357, 0.0 ] } } ], ...
i'm trying figure out how de-serialize in gson. have basic setup:
async call deserialization of json response:
//deserialization type deserializationtype = new typetoken<fusiontablemodel>() {}.gettype(); fusiontablemodel responcewrapper = gson.fromjson(sb.tostring(), deserializationtype);
class:
public class fusiontablemodel { private string kind; private arraylist<string> columns; }
public class example { @expose private string kind; @expose private list<string> columns = new arraylist<string>(); @expose private list<list<string>> rows = new arraylist<list<string>>(); public string getkind() { return kind; } public void setkind(string kind) { this.kind = kind; } public list<string> getcolumns() { return columns; } public void setcolumns(list<string> columns) { this.columns = columns; } public list<list<string>> getrows() { return rows; } public void setrows(list<list<string>> rows) { this.rows = rows; } }
in future there plenty of json pojo tools out there can use generate java json structure.
Comments
Post a Comment