Json总结
Json格式
基本格式
变量名:值
"title":"肖申克的救赎"
值可以是结构体(类),如下,用大括号括起来:
"images": {"small":"http:\/\/img3.douban.com\/view\/movie_poster_cover\/ipst\/public\/p480747492.jpg", "large":"http:\/\/img3.douban.com\/view\/movie_poster_cover\/lpst\/public\/p480747492.jpg", "medium":"http:\/\/img3.douban.com\/view\/movie_poster_cover\/spst\/public\/p480747492.jpg"},
值可以是数组,如下,用中括号括起来:
"genres":["犯罪","剧情"],
数组可以由结构体(类)构成:
"casts":[ {"avatars":{"small":"http:\/\/img3.douban.com\/img\/celebrity\/small\/17525.jpg","large":"http:\/\/img3.douban.com\/img\/celebrity\/large\/17525.jpg","medium":"http:\/\/img3.douban.com\/img\/celebrity\/medium\/17525.jpg"}, "alt":"http:\/\/movie.douban.com\/celebrity\/1054521\/“,”id":"1054521", "name":"蒂姆·罗宾斯"}, {"avatars":{"small":"http:\/\/img3.douban.com\/img\/celebrity\/small\/34642.jpg","large":"http:\/\/img3.douban.com\/img\/celebrity\/large\/34642.jpg","medium":"http:\/\/img3.douban.com\/img\/celebrity\/medium\/34642.jpg"}, "alt":"http:\/\/movie.douban.com\/celebrity\/1054534\/", "id":"1054534", "name":"摩根·弗里曼”}, {“avatars":{"small":"http:\/\/img5.douban.com\/img\/celebrity\/sL;POL,mall\/5837.jpg","large":"http:\/\/img5.douban.com\/img\/celebrity\/large\/5837.jpg","medium":"http:\/\/img5.douban.com\/img\/celebrity\/medium\/5837.jpg"}, "alt":"http:\/\/movie.douban.com\/celebrity\/1041179\/", "id":"1041179", "name":"鲍勃·冈顿"}],
举例
http://api.douban.com/v2/movie/top250
{"rating":{"max":10,"average":9.6,"stars":"50","min":0}, "genres":["犯罪","剧情"], "collect_count":783892, "casts":[ {"avatars":{"small":"http:\/\/img3.douban.com\/img\/celebrity\/small\/17525.jpg","large":"http:\/\/img3.douban.com\/img\/celebrity\/large\/17525.jpg","medium":"http:\/\/img3.douban.com\/img\/celebrity\/medium\/17525.jpg"}, "alt":"http:\/\/movie.douban.com\/celebrity\/1054521\/“,”id":"1054521", "name":"蒂姆·罗宾斯"}, {"avatars":{"small":"http:\/\/img3.douban.com\/img\/celebrity\/small\/34642.jpg","large":"http:\/\/img3.douban.com\/img\/celebrity\/large\/34642.jpg","medium":"http:\/\/img3.douban.com\/img\/celebrity\/medium\/34642.jpg"}, "alt":"http:\/\/movie.douban.com\/celebrity\/1054534\/", "id":"1054534", "name":"摩根·弗里曼”}, {“avatars":{"small":"http:\/\/img5.douban.com\/img\/celebrity\/sL;POL,mall\/5837.jpg","large":"http:\/\/img5.douban.com\/img\/celebrity\/large\/5837.jpg","medium":"http:\/\/img5.douban.com\/img\/celebrity\/medium\/5837.jpg"}, "alt":"http:\/\/movie.douban.com\/celebrity\/1041179\/", "id":"1041179", "name":"鲍勃·冈顿"}], "title":"肖申克的救赎", "original_title":"The Shawshank Redemption", "subtype":"movie", "directors": [{"avatars": {"small":"http:\/\/img3.douban.com\/img\/celebrity\/small\/230.jpg","large":"http:\/\/img3.douban.com\/img\/celebrity\/large\/230.jpg","medium":"http:\/\/img3.douban.com\/img\/celebrity\/medium\/230.jpg"}, "alt":"http:\/\/movie.douban.com\/celebrity\/1047973\/", "id":"1047973", "name":"弗兰克·德拉邦特"}], "year":"1994", "images": {"small":"http:\/\/img3.douban.com\/view\/movie_poster_cover\/ipst\/public\/p480747492.jpg", "large":"http:\/\/img3.douban.com\/view\/movie_poster_cover\/lpst\/public\/p480747492.jpg", "medium":"http:\/\/img3.douban.com\/view\/movie_poster_cover\/spst\/public\/p480747492.jpg"}, "alt":"http:\/\/movie.douban.com\/subject\/1292052\/", "id":"1292052"},
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。