Gson是谷歌用于对Json操作的库,里面有着强大而又方便的功能,最常用的就是
fromJson():将json数据转化为对象;
toJson():将对象转化为json数据!
对于普通的json数据使用这两个方法简直so easy,但是对于稍有点复杂的json数据如何操作呢? 比如json数据中除了json对象外,还有json数组, 有点抽象,来个例子:
比如想通过对象生成一下json数据:
{
"age": "21",
"mList": [
{
"item1": "1111",
"item2": "22222",
"item3": "33333"
}
],
"name": "wistbean",
"sex": "boy"
}
首先,根据json中的数值特点创建对象,可以看到以上json数据中除了有json对象外,还有json数组,那么json对象就要用成员变量,而数组就用list集合;比如这里创建MyJson.class:
package com.wistbean.gsondemo; import com.google.gson.Gson; import java.util.ArrayList;
import java.util.List; /**
* Created by wistbean on 2015/8/27.
*/
public class MyJson { /**
* json对象中的key值name
*/
private String name;
/**
* json对象中的key值age
*/
private String age;
/**
* json对象中的key值sex
*/
private String sex; /**
* json数组 key值mlist
*/
List<list> mList; public MyJson() {
mList = new ArrayList<>();
} public List<list> getmList() {
return mList;
} /**
*将内部类中设置好的数值添加到集合中
*/
public void setmList(list mlist) { mList.add(mlist);
} /**
* 内部类,List集合中的对象,用于映射json数组中的json对象
*/
static class list
{
private String item1;
private String item2;
private String item3; public String getItem1() {
return item1;
} public void setItem1(String item1) {
this.item1 = item1;
} public String getItem2() {
return item2;
} public void setItem2(String item2) {
this.item2 = item2;
} public String getItem3() {
return item3;
} public void setItem3(String item3) {
this.item3 = item3;
}
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public String getAge() {
return age;
} public void setAge(String age) {
this.age = age;
} public String getSex() {
return sex;
} public void setSex(String sex) {
this.sex = sex;
}
} //接下来创建一个MainActivity类测试一下: public class MainActivity extends AppCompatActivity { private String log = "MainActivity"; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); String jsonstr = toJsonString("wistbean","21","boy","1111","22222","33333"); Log.i(log,jsonstr); } /**
*
* @param name 姓名
* @param age 年龄
* @param sex 性别
* @param item1 json数组中的第一个对象
* @param item2 json数组中的第二个对象
* @param item3 json数组中的第三个对象
*/ private String toJsonString(String name,String age,String sex,String item1,String item2,String item3) {
MyJson myjson = new MyJson(); myjson.setName(name);
myjson.setAge(age);
myjson.setSex(sex); MyJson.list list = new MyJson.list(); list.setItem1(item1);
list.setItem2(item2);
list.setItem3(item3); myjson.setmList(list); Gson gson = new Gson();
return gson.toJson(myjson);
} }
主要是将数值设置进去,然后使用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)
JSON返回示例 :
{
"error": 0,
"status": "Success",
"date": "2014-02-13",
"result": [
{
"uid": "56f2f696939903990aa8d45d",
"name": "ume国际影城(华星店)",
"telephone": "(010)82111601",
"location": {
"lng": 116.32575026093,
"lat": 39.967836985325
},
"address": "北京市海淀区双榆树科学院南路44号(双安商场对面)",
"rating": "4.4",
"review": [
{
"content": "挺不错的,离学校近,环境音效都很好,电影比较多上映~",
"date": "14-01-13 21:07:33"
},
{
"content": "团购的,环境很好推荐",
"date": "14-01-16 16:19:43"
},
{
"content": "环境非常好!IMAX尤其效果好,感觉人在其中,身临其境!",
"date": "14-01-13 17:34:10"
}
],
"movies": [
{
"movie_name": "谁说我们不会爱",
"movie_type": "普通",
"movie_nation": "中国大陆",
"movie_director": "刘宝贤",
"movie_starring": "杜淳/颖儿/陈廷嘉/高健/张然",
"movie_release_date": "2014-02-14",
"movie_picture": "http://Img.wangpiao.com/NewsImage/20141/905327e5-4860-4abc-b92b-bbcc8e5dc44e.jpg",
"movie_length": "96分钟",
"movie_description": " 工体摇曳的霓虹夜色,一群不甘寂寞的青年男女:辛小野、苏小暖以及夏泽成、于左左、钱碎碎、海歌、米粒、戴飞等身份各异的人,因为一场宿醉而彼此纠葛,这种纠葛由酒精催化,也因酒精而升华,彼此在最后都收获了一份感动和认知的爱情故事。
伪富二代与文艺女青年的情乱情迷、拜金女与玩物丧志的漫画家梦醒梦碎、强颜欢笑的女领班与青年才俊之间的哀怨纠结,女爷们与伪娘的性情演绎……这并不是命运的阴差阳错,而是深潜在当代年轻人心底的真情爆发。他们伪装,他们放纵,然而当内心深处那份真爱被触动,他们情归原始,万劫不复…… ",
"movie_score": "0.0",
"movie_message": "不对的时间,不对的地点,遇到了对的人",
"movie_tags": "爱情,剧情",
"time_table": [
{
"time": "9:50",
"date": "2014-02-14",
"lan": "中文",
"type": "2D",
"price": 60
}
]
}
]
}
]
}
从中可以看到,这个json数据中,对象中含有数组,数组中又含有对象和数组,然后这个数组又含有对象和数组 –(也是醉了);
那么如何解析呢?
首先获取用get请求获取json数据啦~~ 先创建一个util工具类HttpGetUtil: public class HttpGetUtil { public static String getJsonStringByHttpGet(String url,String apikey)
{ BufferedReader br = null;
InputStream is = null;
StringBuffer sb = null; try {
URL urlpath = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlpath.openConnection();
connection.setReadTimeout(5*1000);
connection.setRequestMethod("GET");
connection.setRequestProperty("apikey",apikey);
connection.connect(); if(connection.getResponseCode() == 200)
{
is = connection.getInputStream();
sb = new StringBuffer();
br = new BufferedReader(new InputStreamReader(is,"UTF-8"));
String line = "";
if((line = br.readLine())!=null)
{
sb.append(line);
}
return sb.toString();
} } catch (Exception e) {
e.printStackTrace();
}finally
{
try {
br.close();
is.close();
} catch (IOException e) {
e.printStackTrace();
}
} return "";
}
这个类主要是用于get请求返回数据,getJsonStringByHttpGet这个方法中传入url和你的apikey然后进行请求,最后返回json数据的字符串!
-----------------------------------------------------------
好了然后在Main方法中测试一下是否有数据:
public class Test { 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";
private final static String apikey = "a4a18e032e283361e7ff876a92480da1"; public static void main(String[] args) { String jsonstr = new HttpGetUtil().getJsonStringByHttpGet(URL, apikey);
System.out.println(jsonstr); } }
利用刚刚写的工具类,传入自己的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:
public class MyJsonData { private String error;
private String status;
private String date;
/**
* json 中的最外层数组。这个数组里面含有对象和别的数组,所以需要创建对象给它装啊;
*/
private List<MyResults> result;
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public List<MyResults> getResult() {
return result;
}
public void setResult(List<MyResults> result) {
this.result = result;
}
@Override
public String toString() {
return "MyJsonData [error=" + error + ", status=" + status + ", date="
+ date + ", result=" + result + "]";
}
创建给list集合装的对象:
public class MyResults { private String uid;
private String name;
private String telephone;
/**
* 这是一个对象
*/
private MyLocation location;
private String address;
private String rating;
/**
* 又是一个数组
*/
private List<MyReView> review;
/**
* 同上
*/
private List<MyMovies> movies;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public MyLocation getLocation() {
return location;
}
public void setLocation(MyLocation location) {
this.location = location;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getRating() {
return rating;
}
public void setRating(String rating) {
this.rating = rating;
}
public List<MyReView> getReview() {
return review;
}
public void setReview(List<MyReView> review) {
this.review = review;
}
public List<MyMovies> getMovies() {
return movies;
}
public void setMovies(List<MyMovies> movies) {
this.movies = movies;
}
@Override
public String toString() {
return "MyResults [uid=" + uid + ", name=" + name + ", telephone="
+ telephone + ", location=" + location + ", address=" + address
+ ", rating=" + rating + ", review=" + review + ", movies="
+ movies + "]";
} }
json数据中数组中又有数组和对象,所以一层一层往里拨~
同理:
//MyReView.class:
public class MyReView { private String content;
private String date;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
@Override
public String toString() {
return "MyReView [content=" + content + ", date=" + date + "]";
}
//MyMovies.class:
public class MyMovies { private String movie_name;
private String movie_type;
private String movie_nation;
private String movie_director;
private String movie_starring;
private String movie_release_date;
private String movie_picture;
private String movie_length;
private String movie_description;
private String movie_score;
private String movie_message;
private String movie_tags;
private List<MyTimeTable> time_table;
public String getMovie_name() {
return movie_name;
}
public void setMovie_name(String movie_name) {
this.movie_name = movie_name;
}
public String getMovie_type() {
return movie_type;
}
public void setMovie_type(String movie_type) {
this.movie_type = movie_type;
}
public String getMovie_nation() {
return movie_nation;
}
public void setMovie_nation(String movie_nation) {
this.movie_nation = movie_nation;
}
public String getMovie_director() {
return movie_director;
}
public void setMovie_director(String movie_director) {
this.movie_director = movie_director;
}
public String getMovie_starring() {
return movie_starring;
}
public void setMovie_starring(String movie_starring) {
this.movie_starring = movie_starring;
}
public String getMovie_release_date() {
return movie_release_date;
}
public void setMovie_release_date(String movie_release_date) {
this.movie_release_date = movie_release_date;
}
public String getMovie_picture() {
return movie_picture;
}
public void setMovie_picture(String movie_picture) {
this.movie_picture = movie_picture;
}
public String getMovie_length() {
return movie_length;
}
public void setMovie_length(String movie_length) {
this.movie_length = movie_length;
}
public String getMovie_description() {
return movie_description;
}
public void setMovie_description(String movie_description) {
this.movie_description = movie_description;
}
public String getMovie_score() {
return movie_score;
}
public void setMovie_score(String movie_score) {
this.movie_score = movie_score;
}
public String getMovie_message() {
return movie_message;
}
public void setMovie_message(String movie_message) {
this.movie_message = movie_message;
}
public String getMovie_tags() {
return movie_tags;
}
public void setMovie_tags(String movie_tags) {
this.movie_tags = movie_tags;
}
public List<MyTimeTable> getTime_table() {
return time_table;
}
public void setTime_table(List<MyTimeTable> time_table) {
this.time_table = time_table;
}
@Override
public String toString() {
return "MyMovies [movie_name=" + movie_name + ", movie_type="
+ movie_type + ", movie_nation=" + movie_nation
+ ", movie_director=" + movie_director + ", movie_starring="
+ movie_starring + ", movie_release_date=" + movie_release_date
+ ", movie_picture=" + movie_picture + ", movie_length="
+ movie_length + ", movie_description=" + movie_description
+ ", movie_score=" + movie_score + ", movie_message="
+ movie_message + ", movie_tags=" + movie_tags
+ ", time_table=" + time_table + "]";
} }
//MyTimeTable.class
public class MyTimeTable { private String time;
private String date;
private String lan;
private String type;
private String price;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getLan() {
return lan;
}
public void setLan(String lan) {
this.lan = lan;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
@Override
public String toString() {
return "MyTimeTable [time=" + time + ", date=" + date + ", lan=" + lan
+ ", type=" + type + ", price=" + price + "]";
} }
注意:在创建类与Gson映射的时候,对成员的命名就是json数据中的key值,不能乱来~~~
好了,接下来再main方法中进行测试:
public class Test { 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";
private final static String apikey = "a4a18e032e283361e7ff876a92480da1"; public static void main(String[] args) { String jsonstr = new HttpGetUtil().getJsonStringByHttpGet(URL, apikey);
// System.out.println(jsonstr);
Gson gson = new Gson();
MyJsonData jsondata = gson.fromJson(jsonstr, MyJsonData.class); System.out.println(jsondata.toString());
} }
运行一下:
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~~~