2 wangruishilongfei wangruishilongfei 于 2014.08.25 21:42 提问

json中如果有数字作为key,使用Gson如何解析

json中如果有数字作为key,使用Gson如何解析
{"attImageMap":
{"22520696":{"OBJID":17436886,"DOCID":22520696,"TYPE":"jpg","LENGTH":378982,"CREATETIMESTAMP":"2014-08-19 18:40:59","UPDATETIMESTAMP":"2014-08-19 18:40:59","PAGE":1,"IMGCACHE":1,"PAGENUM":5},"22520229":{"OBJID":17436552,"DOCID":22520229,"TYPE":"jpg","LENGTH":104112,"CREATETIMESTAMP":"2014-08-19 17:58:23","UPDATETIMESTAMP":"2014-08-19 17:58:23","PAGE":1,"IMGCACHE":1,"PAGENUM":24},"22520650":{"OBJID":17436844,"DOCID":22520650,"TYPE":"jpg","LENGTH":433533,"CREATETIMESTAMP":"2014-08-19 18:37:20","UPDATETIMESTAMP":"2014-08-19 18:37:20","PAGE":1,"IMGCACHE":1,"PAGENUM":4},"22520208":{"OBJID":17436534,"DOCID":22520208,"TYPE":"jpg","LENGTH":461584,"CREATETIMESTAMP":"2014-08-19 17:55:47","UPDATETIMESTAMP":"2014-08-19 17:55:47","PAGE":1,"IMGCACHE":1,"PAGENUM":21},"22520649":{"OBJID":17436843,"DOCID":22520649,"TYPE":"jpg","LENGTH":415667,"CREATETIMESTAMP":"2014-08-19 18:37:21","UPDATETIMESTAMP":"2014-08-19 18:37:21","PAGE":1,"IMGCACHE":1,"PAGENUM":4},"22520493":{"OBJID":17436736,"DOCID":22520493,"TYPE":"jpg","LENGTH":642397,"CREATETIMESTAMP":"2014-08-19 18:36:18","UPDATETIMESTAMP":"2014-08-19 18:36:18","PAGE":1,"IMGCACHE":1,"PAGENUM":20},"22520239":{"OBJID":17436561,"DOCID":22520239,"TYPE":"jpg","LENGTH":631618,"CREATETIMESTAMP":"2014-08-19 17:59:28","UPDATETIMESTAMP":"2014-08-19 17:59:28","PAGE":1,"IMGCACHE":1,"PAGENUM":13},"22520746":{"OBJID":17436921,"DOCID":22520746,"TYPE":"jpg","LENGTH":599334,"CREATETIMESTAMP":"2014-08-19 18:49:09","UPDATETIMESTAMP":"2014-08-19 18:49:09","PAGE":1,"IMGCACHE":1,"PAGENUM":4},"22520481":{"OBJID":17436727,"DOCID":22520481,"TYPE":"jpg","LENGTH":512488,"CREATETIMESTAMP":"2014-08-19 18:22:58","UPDATETIMESTAMP":"2014-08-19 18:22:58","PAGE":1,"IMGCACHE":1,"PAGENUM":14},"22520471":{"OBJID":17436719,"DOCID":22520471,"TYPE":"jpg","LENGTH":465790,"CREATETIMESTAMP":"2014-08-19 18:20:25","UPDATETIMESTAMP":"2014-08-19 18:20:25","PAGE":1,"IMGCACHE":1,"PAGENUM":6},"22520584":{"OBJID":17436800,"DOCID":22520584,"TYPE":"jpg","LENGTH":307522,"CREATETIMESTAMP":"2014-08-19 18:20:23","UPDATETIMESTAMP":"2014-08-19 18:20:23","PAGE":1,"IMGCACHE":1,"PAGENUM":5},"22520426":{"OBJID":17436684,"DOCID":22520426,"TYPE":"jpg","LENGTH":412341,"CREATETIMESTAMP":"2014-08-19 18:15:46","UPDATETIMESTAMP":"2014-08-19 18:15:46","PAGE":1,"IMGCACHE":1,"PAGENUM":11},"22520405":{"OBJID":17436670,"DOCID":22520405,"TYPE":"jpg","LENGTH":509431,"CREATETIMESTAMP":"2014-08-19 18:16:48","UPDATETIMESTAMP":"2014-08-19 18:16:48","PAGE":1,"IMGCACHE":1,"PAGENUM":20},"22520231":{"OBJID":17436554,"DOCID":22520231,"TYPE":"jpg","LENGTH":371571,"CREATETIMESTAMP":"2014-08-19 18:00:30","UPDATETIMESTAMP":"2014-08-19 18:00:30","PAGE":1,"IMGCACHE":1,"PAGENUM":5}}}

1个回答

chquan88888
chquan88888   2015.09.23 15:20

使用@SerializedName("中国画")注解,给Key取别名。
http://www.cnblogs.com/bianmajiang/p/3998083.html

Csdn user default icon
上传中...
上传图片
插入图片