Several usages of learning Gson
Gson parsing (list and map) format JSON data
Basic:
http://blog.csdn.net/onlyonecoder/article/details/16907713
More:
http://blog.csdn.net/lk_blog/article/details/7685169
The method used
Status status = New status (), Status.settoken (token), Status.setx (x), Status.sety (y), Status.setindex (index); Status.setpagesize (pagesize); status.setdistance (distance); String jsonquerystatus = new Gson (). ToJson (status); Httputils http = new Httputils (); Requestparams params = new requestparams (); try {params.setbodyentity (new stringentity (Jsonquerystatus, "utf-8"));} catch (Unsupportedencodingexception e) {e.printstacktrace ();} Http.send (HttpRequest.HttpMethod.GET, Httpgeturl.querystatus (), params, new requestcallback<str
success:[{"id": 155, "userid": "X", "ImageUrl": [null], "Smallimageurl": null, "Content": "", "×": 40.041325, "Y" : 116.288383, "Up": 0, "Down": 0, "Commentnum": 0, "Time": "2014-11-10t15:56:07.000z", "Distance": 4528},
{"id": 154, "userid": "$", "ImageUrl": [null], "Smallimageurl": null, "Content": "", "X": 40.041325, "y": 116.288383, "Up" : 0, "Down": 0, "Commentnum": 0, "Time": "2014-11-10t15:55:47.000z", "Distance": 4528},
{"id": "ImageUrl", "userid": "X", "the": [], "smallimageurl": null, "Content": "", "×": 40.041302, "y": 116.288406, "Up": 0, " Down ": 0," Commentnum ": 0," Time ":" 2014-11-06t15:33:38.000z "," Distance ": 4525},
{"id": 149, "userid": "$", "ImageUrl": [{"Small": "http://storage.jcloud.com/picthumb/ 5e283ccb-e9de-415a-b00c-d05265ce9bb5--avorcachebitmap.png? Expires=3562771397&accesskey=6f9cfed255534762839f4635e37aa680&signature=lyrjncvwkro1qxm52nmmdojnkje%3d "," url ":" Http://storage.jcloud.com/b1name/f8db72e6-2d74-4817-8b99-703a44af8851--avorcachebitmap.png? " expires=3562771397&accesskey=6f9cfed255534762839f4635e37aa680&signature=8vsuih6%2bggjfsdlwqnbr2npnh3u% 3D "}]," Smallimageurl ": null," Content ":" "," X ": 40.041302," y ": 116.288406," Up ": 0," Down ": 0," Commentnum ": 0," Time ":" 2014-11-06t15:29:10.000z "," Distance ": 4525},
{"id": 148, "userid": "Si", "imageurl": [{"Small": "http://storage.jcloud.com/picthumb/ F748764e-3ff7-42db-85fe-1b82fab88b2b--avorcachebitmap.png? expires=3562688469&accesskey=6f9cfed255534762839f4635e37aa680&signature=noymaxvm1io%2fxjmjy34bry% 2fejhw%3d "," url ":" Http://storage.jcloud.com/b1name/b680ba68-0c07-4d1f-9fc0-0fdc4a4d2a8a--avorcachebitmap.png? " expires=3562688469&accesskey=6f9cfed255534762839f4635e37aa680&signature=uswzzkjffn67fc7%2f7nliobbe1xq% 3D "}]," Smallimageurl ": null," Content ":" "," X ": 40.00758," y ": 116.3265," Up ": 0," Down ": 0," Commentnum ": 0," Time ":" 2014-11-05t16:27:03.000z "," Distance ":-},
{"id": 147, "userid": "Si", "imageurl": [{"Small": "http://storage.jcloud.com/picthumb/ Ed10bf56-8707-4df7-be5c-f16fe71d2ed0--avorcachebitmap.png? Expires=3562688466&accesskey=6f9cfed255534762839f4635e37aa680&signature=bmolkdvyqw1otkvc91m2w3ozzra%3d "," url ":" Http://storage.jcloud.com/b1name/81c04dd9-ac9d-48ca-a717-2a9179a3710b--avorcachebitmap.png? " expires=3562688466&accesskey=6f9cfed255534762839f4635e37aa680&signature=t1fdpcn9kscfybk9%2f8jeybkvt08% 3D "}]," Smallimageurl ": null," Content ":" "," X ": 40.00758," y ": 116.3265," Up ": 0," Down ": 0," Commentnum ": 0," Time ":" 2014-11-05t16:26:59.000z "," Distance ": 31},{" id ": 146," userid ":" $ "," ImageUrl ": []," smallimageurl ": null," Content ": "", "X": 40.041321, "y": 116.288414, "Up": 0, "Down": 0, "Commentnum": 0, "Time": "2014-11-05t14:47:34.000z", "Distance" : 4525},{"id": 145, "userid": "" "," ImageUrl ": [null]," Smallimageurl ": null," Content ":" "," X ": 40.041325," Y " : 116.288445, "Up": 0, "Down": 0, "Commentnum": 0, "Time": "2014-11-01t11:42:01.000z", "Distance": 4522},{"id": 144, " UserID ":" 63 ","ImageUrl ": [null]," Smallimageurl ": null," Content ":" "," X ": 40.04134," y ": 116.288445," Up ": 0," Down ": 0," Commentnum ": 0, "Time": "2014-11-01t11:38:58.000z", "Distance": 4522},{"id": 143, "userid": "", "ImageUrl": [null], "Smallimageurl": NULL, "Content": "", "X": 40.04134, "y": 116.288445, "Up": 0, "Down": 0, "Commentnum": 0, "Time": "2014-11-01t11:38:51.000z" , "Distance": 4522}]
The above is JSON and then converted to list
list<status> statuslist = new Gson (). Fromjson (Responseinfo.result, New typetoken<list<status> > () { }.gettype () );
Message Query Situation Analysis 1