{"action":"created","issue":{"url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/77","repository_url":"https://api.github.com/repos/jasminb/jsonapi-converter","labels_url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/77/comments","events_url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/77/events","html_url":"https://github.com/jasminb/jsonapi-converter/issues/77","id":180649551,"number":77,"title":"Q: Deserialising array of different type objects?","user":{"login":"markoilicic","id":3408265,"avatar_url":"https://avatars.githubusercontent.com/u/3408265?v=3","gravatar_id":"","url":"https://api.github.com/users/markoilicic","html_url":"https://github.com/markoilicic","followers_url":"https://api.github.com/users/markoilicic/followers","following_url":"https://api.github.com/users/markoilicic/following{/other_user}","gists_url":"https://api.github.com/users/markoilicic/gists{/gist_id}","starred_url":"https://api.github.com/users/markoilicic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markoilicic/subscriptions","organizations_url":"https://api.github.com/users/markoilicic/orgs","repos_url":"https://api.github.com/users/markoilicic/repos","events_url":"https://api.github.com/users/markoilicic/events{/privacy}","received_events_url":"https://api.github.com/users/markoilicic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-10-03T14:07:37Z","updated_at":"2016-10-16T13:24:40Z","closed_at":null,"body":"Hi Jasmin,\r\n\r\nI'm trying to implement your library, but I'm not able to figure out how it's possible to define parsing  data with array of different types. E.g.:\r\n\r\n```\r\n{\r\n  \"data\": [\r\n    {\r\n      \"id\": \"1\",\r\n      \"type\": \"foo\",\r\n      \"attributes\": {\r\n        \"name\": \"Foo\"\r\n      },\r\n      \"relationships\":{\r\n      }\r\n    },\r\n    {\r\n      \"id\": \"1\",\r\n      \"type\": \"bar\",\r\n      \"attributes\": {\r\n        \"name\": \"bar\"\r\n      },\r\n      \"relationships\":{\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nIs that possible with your library and how? \r\nThanks for answer in front..."},"comment":{"url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/comments/254046752","html_url":"https://github.com/jasminb/jsonapi-converter/issues/77#issuecomment-254046752","issue_url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/77","id":254046752,"user":{"login":"ericn37","id":19919208,"avatar_url":"https://avatars.githubusercontent.com/u/19919208?v=3","gravatar_id":"","url":"https://api.github.com/users/ericn37","html_url":"https://github.com/ericn37","followers_url":"https://api.github.com/users/ericn37/followers","following_url":"https://api.github.com/users/ericn37/following{/other_user}","gists_url":"https://api.github.com/users/ericn37/gists{/gist_id}","starred_url":"https://api.github.com/users/ericn37/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericn37/subscriptions","organizations_url":"https://api.github.com/users/ericn37/orgs","repos_url":"https://api.github.com/users/ericn37/repos","events_url":"https://api.github.com/users/ericn37/events{/privacy}","received_events_url":"https://api.github.com/users/ericn37/received_events","type":"User","site_admin":false},"created_at":"2016-10-16T13:24:40Z","updated_at":"2016-10-16T13:24:40Z","body":"Hi @markoilicic, could you help to shed some more light on your implementation please as I'm having problem achieving it?\r\n\r\nProblem\r\n```\r\njava.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.yyy/com.sephora.digital.views.activities.MyActivity}: java.lang.IllegalArgumentException: Unable to create converter for com.github.jasminb.jsonapi.JSONAPIDocument<com.sephora.digital.models.BaseResource\r\n...\r\n```\r\nModel:\r\n```\r\n@JsonIgnoreProperties(ignoreUnknown = true)\r\n@Type(\"mytype\")\r\npublic class MyModel extends BaseResource {\r\n    @JsonProperty(\"slug-url\")\r\n    private String slug;\r\n}\r\n```\r\nBase Model:\r\n```\r\n@JsonIgnoreProperties(ignoreUnknown = true)\r\n@Type(\"basesourcetype\")\r\npublic abstract class BaseResource {\r\n    @Id\r\n    protected String id;\r\n}\r\n```\r\nRetrofit stuffs:\r\nMyRESTClient.java\r\n```\r\npublic static JSONAPIConverterFactory converterFactoryJasminb = new JSONAPIConverterFactory(converterJasminb);\r\n    public static final Retrofit retrofitJasminb = new Retrofit.Builder()\r\n            .baseUrl(STAGING)\r\n            .client(getOkHttpClient())\r\n            .addConverterFactory(converterFactoryJasminb)\r\n            .build();\r\n// I don't include BaseResource here coz it's abstract\r\npublic static ResourceConverter converterJasminb = new ResourceConverter(\r\n            MyModel.class\r\n);\r\n```\r\nMyService.java\r\n```\r\npublic interface MyService {\r\n\r\n    MyService service = MyRESTClient.retrofitJasminb.create(MyService.class);\r\n\r\n    @GET(\"base/{objectId}\")\r\n    Call<JSONAPIDocument<BaseResource>> fetchTheObject(@Path(\"objectId\") String objectId);\r\n}\r\n```"}}
{"actor":{"display_login":"ericn37"}}