改造没有识别嵌套的json响应

时间:2015-07-13 20:29:19

标签: android gson retrofit

我使用Retrofit获取json响应。我还使用http://www.jsonschema2pojo.org/生成了模型类但是它不起作用。问题是json响应不适合我的java对象。我想念一下吗?

{
   "status":"ok",
   "status_message":"Query was successful",
   "data":{
      "movie_count":1,
      "limit":20,
      "page_number":1,
      "movies":[
         {
            "id":4281,
            "url":"https:\/\/yts.to\/movie\/the-third-man-1949",
            "imdb_code":"tt0041959",
            "title":"The Third Man",
            "title_long":"The Third Man (1949)",
            "slug":"the-third-man-1949",
            "year":1949,
            "rating":8.3,
            "runtime":93,
            "genres":[
               "Film-Noir",
               "Mystery"
            ],
            "language":"English",
            "mpa_rating":"Not Rated",
            "background_image":"https:\/\/s.ynet.io\/assets\/images\/movies\/the_third_man_1949\/background.jpg",
            "small_cover_image":"https:\/\/s.ynet.io\/assets\/images\/movies\/the_third_man_1949\/small-cover.jpg",
            "medium_cover_image":"https:\/\/s.ynet.io\/assets\/images\/movies\/the_third_man_1949\/medium-cover.jpg",
            "state":"ok",
            "date_uploaded":"2015-07-13 10:22:11",
            "date_uploaded_unix":1436739731
         },
      ]
   },
   "@meta":{
      "server_time":1436799207,
      "server_timezone":"Pacific\/Auckland",
      "api_version":2,
      "execution_time":"34.67 ms"
   }
}

1 个答案:

答案 0 :(得分:0)

第31行有一个问题,你在第二个括号{后面放了一个逗号(,)。删除逗号,一切都很好。