android - practice in using retrofit 2.0 -


i'm new in using retrofit... can id, title , thumbnail can't object on arraylist tags..?

please tell me how can do...

here json:

{   code: 200,   result: {   id: "7064",   title: "my title",   thumbnail: "http://myimage.com/image.jpg",   tags: [   {     name: "php",     slug: "php"   },   {    name: "dependencies manager",    slug: "dependencies-manager"   },   {    name: "dependencies",    slug: "dependencies"   },   {    name: "packagist",    slug: "packagist"   }   ]  } } 

and model using gson serialized

public class detail extends observable implements serializable {     @serializedname("code")     public integer code;     @serializedname("result")     public result result;      public class result implements serializable {         @serializedname("id")         public string id;         @serializedname("title")         public string title;         @serializedname("date")         public string date;         @serializedname("thumbnail")         public string thumbnail;         @serializedname("tags")         public arraylist<tags> tags = new arraylist<>();     }      public class tags implements serializable {         @serializedname("name")         public string name;         @serializedname("slug")         public string slug;         public string getname() {             return name;         }     } } 

and api

@get("api/posts/detail/{id}")     call<detail> getdetails (@path("id") string id); 

instead arraylist use list , not initialize it. going

@serializedname("tags") list<tags> tags;  

Comments