Gson是谷歌用于对Json操作的库,里面有着强大而又方便的功能,最常用的就是
fromJson():将json数据转化为对象;
toJson():将对象转化为json数据!
对于普通的json数据使用这两个方法简直so easy,但是对于稍有点复杂的json数据如何操作呢? 比如json数据中除了json对象外,还有json数组, 有点抽象,来个例子:
比如想通过对象生成一下json数据:
1 { 2 "age": "21", 3 "mList": [ 4 { 5 "item1": "1111", 6 "item2": "22222", 7 "item3": "33333" 8 } 9 ], 10 "name": "wistbean", 11 "sex": "boy" 12 }
首先,根据json中的数值特点创建对象,可以看到以上json数据中除了有json对象外,还有json数组,那么json对象就要用成员变量,而数组就用list集合;比如这里创建MyJson.class:
1 package com.wistbean.gsondemo; 2 3 import com.google.gson.Gson; 4 5 import java.util.ArrayList; 6 import java.util.List; 7 8 /** 9 * Created by wistbean on 2015/8/27. 10 */ 11 public class MyJson { 12 13 /** 14 * json对象中的key值name 15 */ 16 private String name; 17 /** 18 * json对象中的key值age 19 */ 20 private String age; 21 /** 22 * json对象中的key值sex 23 */ 24 private String sex; 25 26 /** 27 * json数组 key值mlist 28 */ 29 ListmList; 30 31 public MyJson() { 32 mList = new ArrayList<>(); 33 } 34 35 public List
getmList() { 36 return mList; 37 } 38 39 40 /** 41 *将内部类中设置好的数值添加到集合中 42 */ 43 public void setmList(list mlist) { 44 45 mList.add(mlist); 46 } 47 48 /** 49 * 内部类,List集合中的对象,用于映射json数组中的json对象 50 */ 51 static class list 52 { 53 private String item1; 54 private String item2; 55 private String item3; 56 57 public String getItem1() { 58 return item1; 59 } 60 61 public void setItem1(String item1) { 62 this.item1 = item1; 63 } 64 65 public String getItem2() { 66 return item2; 67 } 68 69 public void setItem2(String item2) { 70 this.item2 = item2; 71 } 72 73 public String getItem3() { 74 return item3; 75 } 76 77 public void setItem3(String item3) { 78 this.item3 = item3; 79 } 80 } 81 82 83 public String getName() { 84 return name; 85 } 86 87 public void setName(String name) { 88 this.name = name; 89 } 90 91 public String getAge() { 92 return age; 93 } 94 95 public void setAge(String age) { 96 this.age = age; 97 } 98 99 public String getSex() { 100 return sex; 101 } 102 103 public void setSex(String sex) { 104 this.sex = sex; 105 } 106 } 107 108 109 110 //接下来创建一个MainActivity类测试一下: 111 112 113 public class MainActivity extends AppCompatActivity { 114 115 private String log = "MainActivity"; 116 117 @Override 118 protected void onCreate(Bundle savedInstanceState) { 119 super.onCreate(savedInstanceState); 120 setContentView(R.layout.activity_main); 121 122 123 String jsonstr = toJsonString("wistbean","21","boy","1111","22222","33333"); 124 125 Log.i(log,jsonstr); 126 127 } 128 129 130 /** 131 * 132 * @param name 姓名 133 * @param age 年龄 134 * @param sex 性别 135 * @param item1 json数组中的第一个对象 136 * @param item2 json数组中的第二个对象 137 * @param item3 json数组中的第三个对象 138 */ 139 140 private String toJsonString(String name,String age,String sex,String item1,String item2,String item3) { 141 MyJson myjson = new MyJson(); 142 143 myjson.setName(name); 144 myjson.setAge(age); 145 myjson.setSex(sex); 146 147 MyJson.list list = new MyJson.list(); 148 149 list.setItem1(item1); 150 list.setItem2(item2); 151 list.setItem3(item3); 152 153 myjson.setmList(list); 154 155 Gson gson = new Gson(); 156 return gson.toJson(myjson); 157 } 158 159 160 }
主要是将数值设置进去,然后使用Gson中的toJson方法。
运行...
I/MainActivity﹕ {"age":"21","mList":[{"item1":"1111","item2":"22222","item3":"33333"}],"name":"wistbean","sex":"boy"} 可以看到log打印出来的数值就是刚刚我想要的结果!
Gson对复杂Json数据的解析:
知道了怎么生成json数据,其实解析就不在话下了,这里就来解析一个复杂点的json数据,比如json对象含有json数组,json数组中又含有json对象和json数组,又含有…
在网上看到一个挺复杂的json数据,GET请求一个影讯查询的API,会得到以下的json数据:
(地址:http://apistore.baidu.com/apiworks/servicedetail/189.html)
1 JSON返回示例 : 2 { 3 "error": 0, 4 "status": "Success", 5 "date": "2014-02-13", 6 "result": [ 7 { 8 "uid": "56f2f696939903990aa8d45d", 9 "name": "ume国际影城(华星店)", 10 "telephone": "(010)82111601", 11 "location": { 12 "lng": 116.32575026093, 13 "lat": 39.967836985325 14 }, 15 "address": "北京市海淀区双榆树科学院南路44号(双安商场对面)", 16 "rating": "4.4", 17 "review": [ 18 { 19 "content": "挺不错的,离学校近,环境音效都很好,电影比较多上映~", 20 "date": "14-01-13 21:07:33" 21 }, 22 { 23 "content": "团购的,环境很好推荐", 24 "date": "14-01-16 16:19:43" 25 }, 26 { 27 "content": "环境非常好!IMAX尤其效果好,感觉人在其中,身临其境!", 28 "date": "14-01-13 17:34:10" 29 } 30 ], 31 "movies": [ 32 { 33 "movie_name": "谁说我们不会爱", 34 "movie_type": "普通", 35 "movie_nation": "中国大陆", 36 "movie_director": "刘宝贤", 37 "movie_starring": "杜淳/颖儿/陈廷嘉/高健/张然", 38 "movie_release_date": "2014-02-14", 39 "movie_picture": "http://Img.wangpiao.com/NewsImage/20141/905327e5-4860-4abc-b92b-bbcc8e5dc44e.jpg", 40 "movie_length": "96分钟", 41 "movie_description": " 工体摇曳的霓虹夜色,一群不甘寂寞的青年男女:辛小野、苏小暖以及夏泽成、于左左、钱碎碎、海歌、米粒、戴飞等身份各异的人,因为一场宿醉而彼此纠葛,这种纠葛由酒精催化,也因酒精而升华,彼此在最后都收获了一份感动和认知的爱情故事。 42 伪富二代与文艺女青年的情乱情迷、拜金女与玩物丧志的漫画家梦醒梦碎、强颜欢笑的女领班与青年才俊之间的哀怨纠结,女爷们与伪娘的性情演绎……这并不是命运的阴差阳错,而是深潜在当代年轻人心底的真情爆发。他们伪装,他们放纵,然而当内心深处那份真爱被触动,他们情归原始,万劫不复…… ", 43 "movie_score": "0.0", 44 "movie_message": "不对的时间,不对的地点,遇到了对的人", 45 "movie_tags": "爱情,剧情", 46 "time_table": [ 47 { 48 "time": "9:50", 49 "date": "2014-02-14", 50 "lan": "中文", 51 "type": "2D", 52 "price": 60 53 } 54 ] 55 } 56 ] 57 } 58 ] 59 }
从中可以看到,这个json数据中,对象中含有数组,数组中又含有对象和数组,然后这个数组又含有对象和数组 –(也是醉了);
那么如何解析呢?
1 首先获取用get请求获取json数据啦~~ 2 3 先创建一个util工具类HttpGetUtil: 4 5 public class HttpGetUtil { 6 7 8 9 public static String getJsonStringByHttpGet(String url,String apikey) 10 { 11 12 BufferedReader br = null; 13 InputStream is = null; 14 StringBuffer sb = null; 15 16 17 try { 18 URL urlpath = new URL(url); 19 HttpURLConnection connection = (HttpURLConnection) urlpath.openConnection(); 20 connection.setReadTimeout(5*1000); 21 connection.setRequestMethod("GET"); 22 connection.setRequestProperty("apikey",apikey); 23 connection.connect(); 24 25 if(connection.getResponseCode() == 200) 26 { 27 is = connection.getInputStream(); 28 sb = new StringBuffer(); 29 br = new BufferedReader(new InputStreamReader(is,"UTF-8")); 30 String line = ""; 31 if((line = br.readLine())!=null) 32 { 33 sb.append(line); 34 } 35 return sb.toString(); 36 } 37 38 } catch (Exception e) { 39 e.printStackTrace(); 40 }finally 41 { 42 try { 43 br.close(); 44 is.close(); 45 } catch (IOException e) { 46 e.printStackTrace(); 47 } 48 } 49 50 return ""; 51 }
这个类主要是用于get请求返回数据,getJsonStringByHttpGet这个方法中传入url和你的apikey然后进行请求,最后返回json数据的字符串!
-----------------------------------------------------------
好了然后在Main方法中测试一下是否有数据:
1 public class Test { 2 3 private final static String URL = "http://apis.baidu.com/apistore/movie/cinema?wd=%E5%8D%8E%E6%98%9F&location=%E5%8C%97%E4%BA%AC&rn=15&output=json&coord_type=bd09ll&out_coord_type=bd09ll"; 4 private final static String apikey = "a4a18e032e283361e7ff876a92480da1"; 5 6 public static void main(String[] args) { 7 8 String jsonstr = new HttpGetUtil().getJsonStringByHttpGet(URL, apikey); 9 System.out.println(jsonstr); 10 11 } 12 13 }
利用刚刚写的工具类,传入自己的url和apikey,打印输出字符串,发现返回来了一大串数据:
1 {"error":0,"status":"Success","date":"2015-08-28","result":[{"uid":"56f2f696939903990aa8d45d","name":"北京UME国际影城(华星店)","telephone":"(010)82115566,(010)82112851","location":{"lng":116.33234602995,"lat":39.973582048317},"address":"北京市海淀区双榆树科学院南路44号(双安商场对面)","rating":"4.0","review":[{"content":"其实和另一个条目重合了,一家电影院。","date":"15-08-06 00:00:00"},{"content":"基本每周都要去看一场,因为放映效果好,离家近啊,格瓦拉在线选座,很方便的。看看最近都有什么好电影","date":"15-07-24 21:35:00"},{"content":"作为离家近,环境又好,交通方便的地方,华星双榆树店绝对是看电影的好地方。IMAX超级给力,当时看的星际迷航,爽歪歪。【路线】地铁四号线人民大学站下车,B口出,向左走,就......","date":"15-06-15 00:00:00"},{"content":"服务差 电影出故障 还不给解决方案 白白浪费了接近一个小时时间","date":"15-07-25 12:33:43"},{"content":"电影都晚点 还一拖再拖","date":"15-07-25 11:51:20"},{"content":"北京仅有的几家IMAX影院,一般有看3d的需求我都回来这边,就是网上订票和预约有些不方便,除非成为他们家VIP有特权优惠","date":"14-08-30 23:16:24"},{"content":"超级赞的一家影院,","date":"14-08-12 14:18:49"},{"content":"老牌了!品質還在,需要提昇","date":"14-08-02 22:25:02"},{"content":"规模比较小,装修也一般,不是硬件发烧友的人来这里看电影,足够了","date":"14-08-02 12:30:04"},{"content":"环境很好,最喜欢去这里看电影了","date":"14-07-20 09:50:39"},{"content":"感觉效果更好很喜欢~真的不错的效果~推荐大家去吧~电影很好","date":"14-07-15 15:35:33"},{"content":"里面吃喝超贵的,矿泉水卖10块,是外面的4倍,爆米花24,真心无语。影厅还可以","date":"14-07-04 18:43:41"},{"content":"周末早场加会员卡四折看电影","date":"14-06-20 23:12:47"},{"content":"效果不错~很喜欢~推荐推荐","date":"14-06-05 08:34:55"},{"content":"环境特好。椅子可以往后放一些","date":"14-05-31 13:49:26"},{"content":"效果很不错。推荐","date":"14-06-09 10:04:52"},{"content":"挺不错的","date":"13-11-03 16:45:09"}],"movies":[{"movie_name":"滚蛋吧!肿瘤君","movie_type":"3D$$imax","movie_nation":"中国","movie_director":"韩延","movie_starring":"白百何,吴彦祖","movie_release_date":"2015-08-13","movie_picture":"http://h.hiphotos.baidu.com/movie/pic/item/5366d0160924ab18009f963d33fae6cd7b890b2a.jpg","movie_length":"120","movie_description":"29岁生日前那天,熊顿因吐槽奇葩老板而丢了工作,又遭遇极品男友劈腿而丢了爱情,还莫名其妙进了趟派出所,但坏运气并没到头,在生日PARTY上欢腾过后,熊顿突然晕倒在了自己的房间。那一刻起,熊顿踏上了一段虽然痛苦但仍然充满欢乐的旅程","movie_score":"8.3","movie_message":"白百合吴彦祖亲历抗癌","movie_tags":"剧情,喜剧","time_table":[{"time":"20:00","date":"2015-08-28","lan":"","type":"","price":""},{"time":"09:50","date":"2015-08-29","lan":"","type":"","price":""},{"time":"15:45","date":"2015-08-29","lan":"","type":"","price":""},{"time":"22:00","date":"2015-08-29","lan":"","type":"","price":""},{"time":"10:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"17:15","date":"2015-08-30","lan":"","type":"","price":""}]},{"movie_name":"终结者:创世纪","movie_type":"2D$$3D$$IMAX3D","movie_nation":"美国","movie_director":"艾伦·泰勒","movie_starring":" 阿诺德·施瓦辛格 , 艾米莉亚·克拉克 , 杰·科特尼 ,杰森·克拉克, 李秉宪 ","movie_release_date":"2015-08-23","movie_picture":"http://a.hiphotos.baidu.com/movie/pic/item/b219ebc4b74543a91245a7c218178a82b9011465.jpg","movie_length":"126","movie_description":"《终结者:创世纪》是经典科幻大片《终结者》的重启之作,在保留原有影片人物的同时,故事也追溯到莎拉·康纳的幼年时期,阿诺饰演的终结者T-800成为了她的“养父”。未来人类领袖约翰·康纳派部下凯尔·里斯“穿越”回到过去保护自己的母亲,凯尔却首先遭遇了液态金属终结者T-1000的追杀,被莎拉救下后,凯尔发现眼前的世界与预计中完全不同,一场关乎人类未来的“人机”大战正式上演。","movie_score":"8.1","movie_message":"加州州长,暴力拯救世界","movie_tags":"科幻,动作,冒险","time_table":[{"time":"18:00","date":"2015-08-28","lan":"","type":"","price":""},{"time":"19:10","date":"2015-08-28","lan":"","type":"","price":""},{"time":"20:20","date":"2015-08-28","lan":"","type":"","price":""},{"time":"21:30","date":"2015-08-28","lan":"","type":"","price":""},{"time":"22:40","date":"2015-08-28","lan":"","type":"","price":""},{"time":"08:30","date":"2015-08-29","lan":"","type":"","price":""},{"time":"09:40","date":"2015-08-29","lan":"","type":"","price":""},{"time":"10:50","date":"2015-08-29","lan":"","type":"","price":""},{"time":"12:00","date":"2015-08-29","lan":"","type":"","price":""},{"time":"13:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"14:20","date":"2015-08-29","lan":"","type":"","price":""},{"time":"15:30","date":"2015-08-29","lan":"","type":"","price":""},{"time":"16:40","date":"2015-08-29","lan":"","type":"","price":""},{"time":"17:50","date":"2015-08-29","lan":"","type":"","price":""},{"time":"19:00","date":"2015-08-29","lan":"","type":"","price":""},{"time":"20:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"21:20","date":"2015-08-29","lan":"","type":"","price":""},{"time":"22:30","date":"2015-08-29","lan":"","type":"","price":""},{"time":"23:30","date":"2015-08-29","lan":"","type":"","price":""},{"time":"08:30","date":"2015-08-30","lan":"","type":"","price":""},{"time":"09:40","date":"2015-08-30","lan":"","type":"","price":""},{"time":"10:50","date":"2015-08-30","lan":"","type":"","price":""},{"time":"12:00","date":"2015-08-30","lan":"","type":"","price":""},{"time":"13:10","date":"2015-08-30","lan":"","type":"","price":""},{"time":"14:20","date":"2015-08-30","lan":"","type":"","price":""},{"time":"15:30","date":"2015-08-30","lan":"","type":"","price":""},{"time":"16:40","date":"2015-08-30","lan":"","type":"","price":""},{"time":"17:50","date":"2015-08-30","lan":"","type":"","price":""},{"time":"19:00","date":"2015-08-30","lan":"","type":"","price":""},{"time":"20:10","date":"2015-08-30","lan":"","type":"","price":""},{"time":"21:20","date":"2015-08-30","lan":"","type":"","price":""},{"time":"22:30","date":"2015-08-30","lan":"","type":"","price":""}]},{"movie_name":"西游记之大圣归来","movie_type":"3D$$中国巨幕","movie_nation":"中国","movie_director":"田晓鹏","movie_starring":"林子杰,张磊,吴文伦,童自荣,刘九容","movie_release_date":"2015-07-10","movie_picture":"http://d.hiphotos.baidu.com/movie/pic/item/95eef01f3a292df563c6968bb9315c6034a87322.jpg","movie_length":"85","movie_description":"大闹天宫后的四百多年,齐天大圣成了一个传说,在山妖横行的长安城,百姓们在朝夕不保中惶惶度日","movie_score":"9.3","movie_message":"萌系齐天大圣归来","movie_tags":"动作,动画,奇幻","time_table":[{"time":"12:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"18:05","date":"2015-08-29","lan":"","type":"","price":""},{"time":"09:00","date":"2015-08-30","lan":"","type":"","price":""},{"time":"13:05","date":"2015-08-30","lan":"","type":"","price":""}]},{"movie_name":"烈日灼心","movie_type":"2D","movie_nation":"中国","movie_director":"曹保平","movie_starring":"高虎,王珞丹,段奕宏,吕颂贤,郭涛,邓超","movie_release_date":"2015-08-27","movie_picture":"http://g.hiphotos.baidu.com/movie/pic/item/0bd162d9f2d3572c870b22af8c13632763d0c3dc.jpg","movie_length":"141","movie_description":"三个结拜兄弟共同抚养着一个孤女,多年来一直潜藏在城市的角落。 一名出租车司机,帮助无数人却从来不接受记者采访;一名协警,除暴安良,却从没想过升迁入职;一名渔夫,每天照料着孤儿的生活……看似风平浪静,实则内心暗涌,直到种种巧合之下, 警察伊谷春以及他的妹妹伊谷夏与他们的生活发生了神秘交织。他们的命运就此改变,曾轰动一时的惊天大案浮出水面,法网和人情究竟谁更无情?","movie_score":"7.7","movie_message":"与原始欲望的终极对抗","movie_tags":"犯罪,悬疑,警匪,剧情","time_table":[{"time":"17:50","date":"2015-08-28","lan":"","type":"","price":""},{"time":"19:10","date":"2015-08-28","lan":"","type":"","price":""},{"time":"20:25","date":"2015-08-28","lan":"","type":"","price":""},{"time":"21:45","date":"2015-08-28","lan":"","type":"","price":""},{"time":"23:00","date":"2015-08-28","lan":"","type":"","price":""},{"time":"09:00","date":"2015-08-29","lan":"","type":"","price":""},{"time":"11:35","date":"2015-08-29","lan":"","type":"","price":""},{"time":"13:00","date":"2015-08-29","lan":"","type":"","price":""},{"time":"14:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"15:35","date":"2015-08-29","lan":"","type":"","price":""},{"time":"16:45","date":"2015-08-29","lan":"","type":"","price":""},{"time":"19:20","date":"2015-08-29","lan":"","type":"","price":""},{"time":"21:55","date":"2015-08-29","lan":"","type":"","price":""},{"time":"09:55","date":"2015-08-30","lan":"","type":"","price":""},{"time":"11:00","date":"2015-08-30","lan":"","type":"","price":""},{"time":"12:30","date":"2015-08-30","lan":"","type":"","price":""},{"time":"13:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"15:05","date":"2015-08-30","lan":"","type":"","price":""},{"time":"16:20","date":"2015-08-30","lan":"","type":"","price":""},{"time":"17:40","date":"2015-08-30","lan":"","type":"","price":""},{"time":"18:55","date":"2015-08-30","lan":"","type":"","price":""},{"time":"20:15","date":"2015-08-30","lan":"","type":"","price":""},{"time":"21:30","date":"2015-08-30","lan":"","type":"","price":""},{"time":"22:50","date":"2015-08-30","lan":"","type":"","price":""}]},{"movie_name":"这里的黎明静悄悄","movie_type":"3D","movie_nation":"俄国,中国","movie_director":"列纳特·达夫列吉亚罗夫","movie_starring":"彼得·费奥多罗夫, 阿纳斯塔西娅·米库尔钦娜,叶夫根尼娅·马拉霍娃,克列斯吉娜·阿斯木斯 ,阿格尼娅·库兹涅佐娃 ,索菲娅·列别节娃","movie_release_date":"2015-08-25","movie_picture":"http://a.hiphotos.baidu.com/movie/pic/item/a5c27d1ed21b0ef47bf5c350dbc451da81cb3e9a.jpg","movie_length":"120","movie_description":"1942年之夏,瓦斯柯夫准尉带领两个班的女机枪手驻扎在一个靠近小车站的村子里。一天,班长丽达在不远的树林里发现了两个空降的德军计划要袭击苏联腹地的军事设施。瓦斯柯夫带领一支小分队去搜查敌军,成员包括丽萨、迦尔卡、丽达、索妮娅、冉妮娅、等五个姑娘。但敌人的力量与自然环境的恶劣远比她们想得要残酷,这些美丽的苏联女战士,不得不在丛林中与人数众多的敌军反复周旋......","movie_score":"7.0","movie_message":"经典重现纪念反法战争","movie_tags":"战争,剧情","time_table":[{"time":"17:50","date":"2015-08-28","lan":"","type":"","price":""},{"time":"11:55","date":"2015-08-29","lan":"","type":"","price":""},{"time":"16:30","date":"2015-08-29","lan":"","type":"","price":""},{"time":"19:50","date":"2015-08-29","lan":"","type":"","price":""},{"time":"11:35","date":"2015-08-30","lan":"","type":"","price":""},{"time":"13:35","date":"2015-08-30","lan":"","type":"","price":""},{"time":"22:00","date":"2015-08-30","lan":"","type":"","price":""}]},{"movie_name":"刺客聂隐娘 ","movie_type":"2D","movie_nation":"台湾,中国大陆,香港,法国","movie_director":"侯孝贤 ","movie_starring":"张震,舒淇,阮经天,周韵,戴立忍,许芳宜, 谢欣颖 ,妻夫木聪","movie_release_date":"2015-08-27","movie_picture":"http://c.hiphotos.baidu.com/movie/pic/item/faf2b2119313b07ed8882b090ad7912397dd8cfd.jpg","movie_length":"104","movie_description":"聂隐娘(舒淇 饰)幼时被一道姑掳走,过了13年被送回已是一名技艺高超的女刺客,而师傅送她回来的目的竟然是刺杀青梅竹马的表兄——田季安(张震 饰)。师傅对她说“剑道无亲,不与圣人同忧“,而剑术已成的聂隐娘,最后能否斩绝人伦之亲,得到自己的道? ","movie_score":"8.5","movie_message":"舒淇演绎无法杀人的女杀手","movie_tags":"剧情,动作,武侠,古装","time_table":[{"time":"19:20","date":"2015-08-28","lan":"","type":"","price":""},{"time":"21:20","date":"2015-08-28","lan":"","type":"","price":""},{"time":"22:20","date":"2015-08-28","lan":"","type":"","price":""},{"time":"23:15","date":"2015-08-28","lan":"","type":"","price":""},{"time":"09:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"11:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"13:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"15:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"17:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"18:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"19:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"20:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"21:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"22:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"08:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"10:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"12:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"14:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"15:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"16:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"17:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"18:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"19:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"20:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"21:45","date":"2015-08-30","lan":"","type":"","price":""},{"time":"22:45","date":"2015-08-30","lan":"","type":"","price":""}]},{"movie_name":"三城记","movie_type":"2D","movie_nation":"中国","movie_director":"张婉婷","movie_starring":"秦海璐,金燕玲,刘青云,汤唯,井柏然,黄觉","movie_release_date":"2015-08-27","movie_picture":"http://a.hiphotos.baidu.com/movie/pic/item/241f95cad1c8a786d969db6f6109c93d70cf500b.jpg","movie_length":"130","movie_description":"电影《三城记》取材自真实的故事,因《玻璃之城》、《岁月神偷》等备受好评、获奖无数的香港金牌搭档再度合作,张婉婷导演,罗启锐监制,两位共同创作剧本,美术大师叶锦添精心雕琢30余场景,恋人的悲欢离合在战火纷飞中更显浪漫动人。影帝刘青云和影后汤唯首度携手,金马影后秦海璐、作品井喷的井柏然和魅力型男黄觉等倾情加盟,讲述在战火纷飞的背景之下,几位主人公辗转于徽州、上海和香港三个城市之间,用生命追逐爱情,上演一段浪漫的乱世爱情故事,成为一段传奇。","movie_score":"8.0","movie_message":"中国版的《乱世佳人》","movie_tags":"剧情,爱情","time_table":[{"time":"18:25","date":"2015-08-28","lan":"","type":"","price":""},{"time":"20:50","date":"2015-08-28","lan":"","type":"","price":""},{"time":"09:30","date":"2015-08-29","lan":"","type":"","price":""},{"time":"14:05","date":"2015-08-29","lan":"","type":"","price":""},{"time":"18:40","date":"2015-08-29","lan":"","type":"","price":""},{"time":"21:05","date":"2015-08-29","lan":"","type":"","price":""},{"time":"09:10","date":"2015-08-30","lan":"","type":"","price":""},{"time":"14:50","date":"2015-08-30","lan":"","type":"","price":""},{"time":"19:35","date":"2015-08-30","lan":"","type":"","price":""}]},{"movie_name":"百团大战","movie_type":"2D","movie_nation":"中国","movie_director":"宁海强,张玉中","movie_starring":"吴越,陶泽如,印小天,邓超,刘之冰, 唐国强 ","movie_release_date":"2015-08-28","movie_picture":"http://g.hiphotos.baidu.com/movie/pic/item/94cad1c8a786c9179950a84dcf3d70cf3bc75777.jpg","movie_length":"111","movie_description":"百团大战是中国抗日战争时期,中国领导下的八路军和广大人民群众与日军在中国华北地区发动的一次规模最大、持续时间最长的战役。这场战争极大的影响了整个世界反法西斯战争格局,起到了非常重要的作用:首先是牵制住了日本兵力,同时中国的大胆出手,也影响到其它国家也开始勇于在东南亚战场、太平洋战场和欧洲战场强势出击,正面对战。","movie_score":"7.0","movie_message":"驱除鞑虏,还我中华!","movie_tags":"历史,战争","time_table":[{"time":"23:50","date":"2015-08-28","lan":"","type":"","price":""},{"time":"07:35","date":"2015-08-29","lan":"","type":"","price":""}]},{"movie_name":"诱狼","movie_type":"2D","movie_nation":"中国","movie_director":" 安澜 ","movie_starring":"侯勇, 巩峥 , 罗昱焜 , 陆彭 ,高明, 陈婧旸 ","movie_release_date":"2015-08-25","movie_picture":"http://b.hiphotos.baidu.com/movie/pic/item/77094b36acaf2edd029fac8c8b1001e93901936d.jpg","movie_length":"95","movie_description":" 被称作日军“名将之花”的阿部规秀官至中将是当时横亘在我军面前的一道坎,他以残忍的作战风格震慑着军中的将士,更以极其残酷的手段对付敌人,他是日军用以对付八路军和游击队的坚强而残酷的战略武器,而八路军即将终止日军这个不可战胜的神话,这个名将之花终将凋谢于太行山上。","movie_score":"7.3","movie_message":"重创敌军之花","movie_tags":"剧情,战争","time_table":[{"time":"08:00","date":"2015-08-29","lan":"","type":"","price":""},{"time":"09:20","date":"2015-08-29","lan":"","type":"","price":""},{"time":"11:10","date":"2015-08-29","lan":"","type":"","price":""},{"time":"13:55","date":"2015-08-29","lan":"","type":"","price":""}]}]}]}
(好吧,贴出来也是醉了。。。)
那么就要解析这些东东了~~~:
{} :代表的是对象,所以需要创建对象;
[] :代表的是数组,so,要用List集合来装~
创建一个最外层也是最大的对象MyJsonData:
1 public class MyJsonData { 2 3 private String error; 4 private String status; 5 private String date; 6 /** 7 * json 中的最外层数组。这个数组里面含有对象和别的数组,所以需要创建对象给它装啊; 8 */ 9 private Listresult; 10 public String getError() { 11 return error; 12 } 13 public void setError(String error) { 14 this.error = error; 15 } 16 public String getStatus() { 17 return status; 18 } 19 public void setStatus(String status) { 20 this.status = status; 21 } 22 public String getDate() { 23 return date; 24 } 25 public void setDate(String date) { 26 this.date = date; 27 } 28 public List getResult() { 29 return result; 30 } 31 public void setResult(List result) { 32 this.result = result; 33 } 34 @Override 35 public String toString() { 36 return "MyJsonData [error=" + error + ", status=" + status + ", date=" 37 + date + ", result=" + result + "]"; 38 }
创建给list集合装的对象:
1 public class MyResults { 2 3 private String uid; 4 private String name; 5 private String telephone; 6 /** 7 * 这是一个对象 8 */ 9 private MyLocation location; 10 private String address; 11 private String rating; 12 /** 13 * 又是一个数组 14 */ 15 private Listreview; 16 /** 17 * 同上 18 */ 19 private List movies; 20 public String getUid() { 21 return uid; 22 } 23 public void setUid(String uid) { 24 this.uid = uid; 25 } 26 public String getName() { 27 return name; 28 } 29 public void setName(String name) { 30 this.name = name; 31 } 32 public String getTelephone() { 33 return telephone; 34 } 35 public void setTelephone(String telephone) { 36 this.telephone = telephone; 37 } 38 public MyLocation getLocation() { 39 return location; 40 } 41 public void setLocation(MyLocation location) { 42 this.location = location; 43 } 44 public String getAddress() { 45 return address; 46 } 47 public void setAddress(String address) { 48 this.address = address; 49 } 50 public String getRating() { 51 return rating; 52 } 53 public void setRating(String rating) { 54 this.rating = rating; 55 } 56 public List getReview() { 57 return review; 58 } 59 public void setReview(List review) { 60 this.review = review; 61 } 62 public List getMovies() { 63 return movies; 64 } 65 public void setMovies(List movies) { 66 this.movies = movies; 67 } 68 @Override 69 public String toString() { 70 return "MyResults [uid=" + uid + ", name=" + name + ", telephone=" 71 + telephone + ", location=" + location + ", address=" + address 72 + ", rating=" + rating + ", review=" + review + ", movies=" 73 + movies + "]"; 74 } 75 76 }
json数据中数组中又有数组和对象,所以一层一层往里拨~
同理:
//MyReView.class:
1 public class MyReView { 2 3 private String content; 4 private String date; 5 public String getContent() { 6 return content; 7 } 8 public void setContent(String content) { 9 this.content = content; 10 } 11 public String getDate() { 12 return date; 13 } 14 public void setDate(String date) { 15 this.date = date; 16 } 17 @Override 18 public String toString() { 19 return "MyReView [content=" + content + ", date=" + date + "]"; 20 }
//MyMovies.class:
1 public class MyMovies { 2 3 private String movie_name; 4 private String movie_type; 5 private String movie_nation; 6 private String movie_director; 7 private String movie_starring; 8 private String movie_release_date; 9 private String movie_picture; 10 private String movie_length; 11 private String movie_description; 12 private String movie_score; 13 private String movie_message; 14 private String movie_tags; 15 private Listtime_table; 16 public String getMovie_name() { 17 return movie_name; 18 } 19 public void setMovie_name(String movie_name) { 20 this.movie_name = movie_name; 21 } 22 public String getMovie_type() { 23 return movie_type; 24 } 25 public void setMovie_type(String movie_type) { 26 this.movie_type = movie_type; 27 } 28 public String getMovie_nation() { 29 return movie_nation; 30 } 31 public void setMovie_nation(String movie_nation) { 32 this.movie_nation = movie_nation; 33 } 34 public String getMovie_director() { 35 return movie_director; 36 } 37 public void setMovie_director(String movie_director) { 38 this.movie_director = movie_director; 39 } 40 public String getMovie_starring() { 41 return movie_starring; 42 } 43 public void setMovie_starring(String movie_starring) { 44 this.movie_starring = movie_starring; 45 } 46 public String getMovie_release_date() { 47 return movie_release_date; 48 } 49 public void setMovie_release_date(String movie_release_date) { 50 this.movie_release_date = movie_release_date; 51 } 52 public String getMovie_picture() { 53 return movie_picture; 54 } 55 public void setMovie_picture(String movie_picture) { 56 this.movie_picture = movie_picture; 57 } 58 public String getMovie_length() { 59 return movie_length; 60 } 61 public void setMovie_length(String movie_length) { 62 this.movie_length = movie_length; 63 } 64 public String getMovie_description() { 65 return movie_description; 66 } 67 public void setMovie_description(String movie_description) { 68 this.movie_description = movie_description; 69 } 70 public String getMovie_score() { 71 return movie_score; 72 } 73 public void setMovie_score(String movie_score) { 74 this.movie_score = movie_score; 75 } 76 public String getMovie_message() { 77 return movie_message; 78 } 79 public void setMovie_message(String movie_message) { 80 this.movie_message = movie_message; 81 } 82 public String getMovie_tags() { 83 return movie_tags; 84 } 85 public void setMovie_tags(String movie_tags) { 86 this.movie_tags = movie_tags; 87 } 88 public List getTime_table() { 89 return time_table; 90 } 91 public void setTime_table(List time_table) { 92 this.time_table = time_table; 93 } 94 @Override 95 public String toString() { 96 return "MyMovies [movie_name=" + movie_name + ", movie_type=" 97 + movie_type + ", movie_nation=" + movie_nation 98 + ", movie_director=" + movie_director + ", movie_starring=" 99 + movie_starring + ", movie_release_date=" + movie_release_date 100 + ", movie_picture=" + movie_picture + ", movie_length=" 101 + movie_length + ", movie_description=" + movie_description 102 + ", movie_score=" + movie_score + ", movie_message=" 103 + movie_message + ", movie_tags=" + movie_tags 104 + ", time_table=" + time_table + "]"; 105 } 106 107 }
//MyTimeTable.class
1 public class MyTimeTable { 2 3 private String time; 4 private String date; 5 private String lan; 6 private String type; 7 private String price; 8 public String getTime() { 9 return time; 10 } 11 public void setTime(String time) { 12 this.time = time; 13 } 14 public String getDate() { 15 return date; 16 } 17 public void setDate(String date) { 18 this.date = date; 19 } 20 public String getLan() { 21 return lan; 22 } 23 public void setLan(String lan) { 24 this.lan = lan; 25 } 26 public String getType() { 27 return type; 28 } 29 public void setType(String type) { 30 this.type = type; 31 } 32 public String getPrice() { 33 return price; 34 } 35 public void setPrice(String price) { 36 this.price = price; 37 } 38 @Override 39 public String toString() { 40 return "MyTimeTable [time=" + time + ", date=" + date + ", lan=" + lan 41 + ", type=" + type + ", price=" + price + "]"; 42 } 43 44 }
注意:在创建类与Gson映射的时候,对成员的命名就是json数据中的key值,不能乱来~~~
好了,接下来再main方法中进行测试:
1 public class Test { 2 3 private final static String URL = "http://apis.baidu.com/apistore/movie/cinema?wd=%E5%8D%8E%E6%98%9F&location=%E5%8C%97%E4%BA%AC&rn=15&output=json&coord_type=bd09ll&out_coord_type=bd09ll"; 4 private final static String apikey = "a4a18e032e283361e7ff876a92480da1"; 5 6 public static void main(String[] args) { 7 8 String jsonstr = new HttpGetUtil().getJsonStringByHttpGet(URL, apikey); 9 // System.out.println(jsonstr); 10 Gson gson = new Gson(); 11 MyJsonData jsondata = gson.fromJson(jsonstr, MyJsonData.class); 12 13 System.out.println(jsondata.toString()); 14 } 15 16 }
运行一下:
1 MyJsonData [error=0, status=Success, date=2015-08-28, result=[MyResults [uid=56f2f696939903990aa8d45d, name=北京UME国际影城(华星店), telephone=(010)82115566,(010)82112851, location=MyLocation [lng=116.33234602995, lat=39.973582048317], address=北京市海淀区双榆树科学院南路44号(双安商场对面), rating=4.0, review=[MyReView [content=其实和另一个条目重合了,一家电影院。, date=15-08-06 00:00:00], MyReView [content=基本每周都要去看一场,因为放映效果好,离家近啊,格瓦拉在线选座,很方便的。看看最近都有什么好电影, date=15-07-24 21:35:00], MyReView [content=作为离家近,环境又好,交通方便的地方,华星双榆树店绝对是看电影的好地方。IMAX超级给力,当时看的星际迷航,爽歪歪。【路线】地铁四号线人民大学站下车,B口出,向左走,就......, date=15-06-15 00:00:00], MyReView [content=服务差 电影出故障 还不给解决方案 白白浪费了接近一个小时时间, date=15-07-25 12:33:43], MyReView [content=电影都晚点 还一拖再拖, date=15-07-25 11:51:20], MyReView [content=北京仅有的几家IMAX影院,一般有看3d的需求我都回来这边,就是网上订票和预约有些不方便,除非成为他们家VIP有特权优惠, date=14-08-30 23:16:24], MyReView [content=超级赞的一家影院,, date=14-08-12 14:18:49], MyReView [content=老牌了!品質還在,需要提昇, date=14-08-02 22:25:02], MyReView [content=规模比较小,装修也一般,不是硬件发烧友的人来这里看电影,足够了, date=14-08-02 12:30:04], MyReView [content=环境很好,最喜欢去这里看电影了, date=14-07-20 09:50:39], MyReView [content=感觉效果更好很喜欢~真的不错的效果~推荐大家去吧~电影很好, date=14-07-15 15:35:33], MyReView [content=里面吃喝超贵的,矿泉水卖10块,是外面的4倍,爆米花24,真心无语。影厅还可以, date=14-07-04 18:43:41], MyReView [content=周末早场加会员卡四折看电影, date=14-06-20 23:12:47], MyReView [content=效果不错~很喜欢~推荐推荐, date=14-06-05 08:34:55], MyReView [content=环境特好。椅子可以往后放一些, date=14-05-31 13:49:26], MyReView [content=效果很不错。推荐, date=14-06-09 10:04:52], MyReView [content=挺不错的, date=13-11-03 16:45:09]], movies=[MyMovies [movie_name=滚蛋吧!肿瘤君, movie_type=3D$$imax, movie_nation=中国, movie_director=韩延, movie_starring=白百何,吴彦祖, movie_release_date=2015-08-13, movie_picture=http://h.hiphotos.baidu.com/movie/pic/item/5366d0160924ab18009f963d33fae6cd7b890b2a.jpg, movie_length=120, movie_description=29岁生日前那天,熊顿因吐槽奇葩老板而丢了工作,又遭遇极品男友劈腿而丢了爱情,还莫名其妙进了趟派出所,但坏运气并没到头,在生日PARTY上欢腾过后,熊顿突然晕倒在了自己的房间。那一刻起,熊顿踏上了一段虽然痛苦但仍然充满欢乐的旅程, movie_score=8.3, movie_message=白百合吴彦祖亲历抗癌, movie_tags=剧情,喜剧, time_table=[MyTimeTable [time=20:00, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=09:50, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=15:45, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=22:00, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=10:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=17:15, date=2015-08-30, lan=, type=, price=]]], MyMovies [movie_name=终结者:创世纪, movie_type=2D$$3D$$IMAX3D, movie_nation=美国, movie_director=艾伦·泰勒, movie_starring= 阿诺德·施瓦辛格 , 艾米莉亚·克拉克 , 杰·科特尼 ,杰森·克拉克, 李秉宪 , movie_release_date=2015-08-23, movie_picture=http://a.hiphotos.baidu.com/movie/pic/item/b219ebc4b74543a91245a7c218178a82b9011465.jpg, movie_length=126, movie_description=《终结者:创世纪》是经典科幻大片《终结者》的重启之作,在保留原有影片人物的同时,故事也追溯到莎拉·康纳的幼年时期,阿诺饰演的终结者T-800成为了她的“养父”。未来人类领袖约翰·康纳派部下凯尔·里斯“穿越”回到过去保护自己的母亲,凯尔却首先遭遇了液态金属终结者T-1000的追杀,被莎拉救下后,凯尔发现眼前的世界与预计中完全不同,一场关乎人类未来的“人机”大战正式上演。, movie_score=8.1, movie_message=加州州长,暴力拯救世界, movie_tags=科幻,动作,冒险, time_table=[MyTimeTable [time=18:00, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=19:10, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=20:20, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=21:30, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=22:40, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=08:30, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=09:40, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=10:50, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=12:00, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=13:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=14:20, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=15:30, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=16:40, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=17:50, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=19:00, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=20:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=21:20, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=22:30, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=23:30, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=08:30, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=09:40, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=10:50, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=12:00, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=13:10, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=14:20, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=15:30, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=16:40, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=17:50, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=19:00, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=20:10, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=21:20, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=22:30, date=2015-08-30, lan=, type=, price=]]], MyMovies [movie_name=西游记之大圣归来, movie_type=3D$$中国巨幕, movie_nation=中国, movie_director=田晓鹏, movie_starring=林子杰,张磊,吴文伦,童自荣,刘九容, movie_release_date=2015-07-10, movie_picture=http://d.hiphotos.baidu.com/movie/pic/item/95eef01f3a292df563c6968bb9315c6034a87322.jpg, movie_length=85, movie_description=大闹天宫后的四百多年,齐天大圣成了一个传说,在山妖横行的长安城,百姓们在朝夕不保中惶惶度日, movie_score=9.3, movie_message=萌系齐天大圣归来, movie_tags=动作,动画,奇幻, time_table=[MyTimeTable [time=12:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=18:05, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=09:00, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=13:05, date=2015-08-30, lan=, type=, price=]]], MyMovies [movie_name=烈日灼心, movie_type=2D, movie_nation=中国, movie_director=曹保平, movie_starring=高虎,王珞丹,段奕宏,吕颂贤,郭涛,邓超, movie_release_date=2015-08-27, movie_picture=http://g.hiphotos.baidu.com/movie/pic/item/0bd162d9f2d3572c870b22af8c13632763d0c3dc.jpg, movie_length=141, movie_description=三个结拜兄弟共同抚养着一个孤女,多年来一直潜藏在城市的角落。 一名出租车司机,帮助无数人却从来不接受记者采访;一名协警,除暴安良,却从没想过升迁入职;一名渔夫,每天照料着孤儿的生活……看似风平浪静,实则内心暗涌,直到种种巧合之下, 警察伊谷春以及他的妹妹伊谷夏与他们的生活发生了神秘交织。他们的命运就此改变,曾轰动一时的惊天大案浮出水面,法网和人情究竟谁更无情?, movie_score=7.7, movie_message=与原始欲望的终极对抗, movie_tags=犯罪,悬疑,警匪,剧情, time_table=[MyTimeTable [time=17:50, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=19:10, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=20:25, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=21:45, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=23:00, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=09:00, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=11:35, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=13:00, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=14:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=15:35, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=16:45, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=19:20, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=21:55, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=09:55, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=11:00, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=12:30, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=13:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=15:05, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=16:20, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=17:40, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=18:55, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=20:15, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=21:30, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=22:50, date=2015-08-30, lan=, type=, price=]]], MyMovies [movie_name=这里的黎明静悄悄, movie_type=3D, movie_nation=俄国,中国, movie_director=列纳特·达夫列吉亚罗夫, movie_starring=彼得·费奥多罗夫, 阿纳斯塔西娅·米库尔钦娜,叶夫根尼娅·马拉霍娃,克列斯吉娜·阿斯木斯 ,阿格尼娅·库兹涅佐娃 ,索菲娅·列别节娃, movie_release_date=2015-08-25, movie_picture=http://a.hiphotos.baidu.com/movie/pic/item/a5c27d1ed21b0ef47bf5c350dbc451da81cb3e9a.jpg, movie_length=120, movie_description=1942年之夏,瓦斯柯夫准尉带领两个班的女机枪手驻扎在一个靠近小车站的村子里。一天,班长丽达在不远的树林里发现了两个空降的德军计划要袭击苏联腹地的军事设施。瓦斯柯夫带领一支小分队去搜查敌军,成员包括丽萨、迦尔卡、丽达、索妮娅、冉妮娅、等五个姑娘。但敌人的力量与自然环境的恶劣远比她们想得要残酷,这些美丽的苏联女战士,不得不在丛林中与人数众多的敌军反复周旋......, movie_score=7.0, movie_message=经典重现纪念反法战争, movie_tags=战争,剧情, time_table=[MyTimeTable [time=17:50, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=11:55, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=16:30, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=19:50, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=11:35, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=13:35, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=22:00, date=2015-08-30, lan=, type=, price=]]], MyMovies [movie_name=刺客聂隐娘 , movie_type=2D, movie_nation=台湾,中国大陆,香港,法国, movie_director=侯孝贤 , movie_starring=张震,舒淇,阮经天,周韵,戴立忍,许芳宜, 谢欣颖 ,妻夫木聪, movie_release_date=2015-08-27, movie_picture=http://c.hiphotos.baidu.com/movie/pic/item/faf2b2119313b07ed8882b090ad7912397dd8cfd.jpg, movie_length=104, movie_description=聂隐娘(舒淇 饰)幼时被一道姑掳走,过了13年被送回已是一名技艺高超的女刺客,而师傅送她回来的目的竟然是刺杀青梅竹马的表兄——田季安(张震 饰)。师傅对她说“剑道无亲,不与圣人同忧“,而剑术已成的聂隐娘,最后能否斩绝人伦之亲,得到自己的道? , movie_score=8.5, movie_message=舒淇演绎无法杀人的女杀手, movie_tags=剧情,动作,武侠,古装, time_table=[MyTimeTable [time=19:20, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=21:20, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=22:20, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=23:15, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=09:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=11:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=13:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=15:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=17:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=18:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=19:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=20:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=21:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=22:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=08:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=10:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=12:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=14:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=15:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=16:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=17:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=18:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=19:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=20:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=21:45, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=22:45, date=2015-08-30, lan=, type=, price=]]], MyMovies [movie_name=三城记, movie_type=2D, movie_nation=中国, movie_director=张婉婷, movie_starring=秦海璐,金燕玲,刘青云,汤唯,井柏然,黄觉, movie_release_date=2015-08-27, movie_picture=http://a.hiphotos.baidu.com/movie/pic/item/241f95cad1c8a786d969db6f6109c93d70cf500b.jpg, movie_length=130, movie_description=电影《三城记》取材自真实的故事,因《玻璃之城》、《岁月神偷》等备受好评、获奖无数的香港金牌搭档再度合作,张婉婷导演,罗启锐监制,两位共同创作剧本,美术大师叶锦添精心雕琢30余场景,恋人的悲欢离合在战火纷飞中更显浪漫动人。影帝刘青云和影后汤唯首度携手,金马影后秦海璐、作品井喷的井柏然和魅力型男黄觉等倾情加盟,讲述在战火纷飞的背景之下,几位主人公辗转于徽州、上海和香港三个城市之间,用生命追逐爱情,上演一段浪漫的乱世爱情故事,成为一段传奇。, movie_score=8.0, movie_message=中国版的《乱世佳人》, movie_tags=剧情,爱情, time_table=[MyTimeTable [time=18:25, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=20:50, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=09:30, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=14:05, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=18:40, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=21:05, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=09:10, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=14:50, date=2015-08-30, lan=, type=, price=], MyTimeTable [time=19:35, date=2015-08-30, lan=, type=, price=]]], MyMovies [movie_name=百团大战, movie_type=2D, movie_nation=中国, movie_director=宁海强,张玉中, movie_starring=吴越,陶泽如,印小天,邓超,刘之冰, 唐国强 , movie_release_date=2015-08-28, movie_picture=http://g.hiphotos.baidu.com/movie/pic/item/94cad1c8a786c9179950a84dcf3d70cf3bc75777.jpg, movie_length=111, movie_description=百团大战是中国抗日战争时期,中国领导下的八路军和广大人民群众与日军在中国华北地区发动的一次规模最大、持续时间最长的战役。这场战争极大的影响了整个世界反法西斯战争格局,起到了非常重要的作用:首先是牵制住了日本兵力,同时中国的大胆出手,也影响到其它国家也开始勇于在东南亚战场、太平洋战场和欧洲战场强势出击,正面对战。, movie_score=7.0, movie_message=驱除鞑虏,还我中华!, movie_tags=历史,战争, time_table=[MyTimeTable [time=23:50, date=2015-08-28, lan=, type=, price=], MyTimeTable [time=07:35, date=2015-08-29, lan=, type=, price=]]], MyMovies [movie_name=诱狼, movie_type=2D, movie_nation=中国, movie_director= 安澜 , movie_starring=侯勇, 巩峥 , 罗昱焜 , 陆彭 ,高明, 陈婧旸 , movie_release_date=2015-08-25, movie_picture=http://b.hiphotos.baidu.com/movie/pic/item/77094b36acaf2edd029fac8c8b1001e93901936d.jpg, movie_length=95, movie_description= 被称作日军“名将之花”的阿部规秀官至中将是当时横亘在我军面前的一道坎,他以残忍的作战风格震慑着军中的将士,更以极其残酷的手段对付敌人,他是日军用以对付八路军和游击队的坚强而残酷的战略武器,而八路军即将终止日军这个不可战胜的神话,这个名将之花终将凋谢于太行山上。, movie_score=7.3, movie_message=重创敌军之花, movie_tags=剧情,战争, time_table=[MyTimeTable [time=08:00, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=09:20, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=11:10, date=2015-08-29, lan=, type=, price=], MyTimeTable [time=13:55, date=2015-08-29, lan=, type=, price=]]]]]]]
可以看到,所有的所有,都被解析出来了!O(∩_∩)O~~~