{"action":"created","issue":{"url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/64","repository_url":"https://api.github.com/repos/jasminb/jsonapi-converter","labels_url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/64/comments","events_url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/64/events","html_url":"https://github.com/jasminb/jsonapi-converter/issues/64","id":170068351,"number":64,"title":"ResourceConverter should allow deserializing arbitrary JSON-API–compliant objects","user":{"login":"hndmrsh","id":2135075,"avatar_url":"https://avatars.githubusercontent.com/u/2135075?v=3","gravatar_id":"","url":"https://api.github.com/users/hndmrsh","html_url":"https://github.com/hndmrsh","followers_url":"https://api.github.com/users/hndmrsh/followers","following_url":"https://api.github.com/users/hndmrsh/following{/other_user}","gists_url":"https://api.github.com/users/hndmrsh/gists{/gist_id}","starred_url":"https://api.github.com/users/hndmrsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hndmrsh/subscriptions","organizations_url":"https://api.github.com/users/hndmrsh/orgs","repos_url":"https://api.github.com/users/hndmrsh/repos","events_url":"https://api.github.com/users/hndmrsh/events{/privacy}","received_events_url":"https://api.github.com/users/hndmrsh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-09T02:30:31Z","updated_at":"2016-08-09T22:25:09Z","closed_at":null,"body":"Hi,\r\n\r\nTo my knowledge, the only way to deserialize a JSON-API object with a ResourceConverter  at the moment is to use the `readDocument(byte[], Class)`. This requires prior knowledge of the type of object to be deserialized - this can sometimes be an issue, as it is not always possible to know what type of object we are expecting. For example, my Android client is registered to receive push notifications, which can be one of several types. Given that `@Type`-annotated models exist to deserialize each of these types (and are registered with the ResourceConverter), it would be nice to be able to use the ResourceConverter to determine which model the object should be deserialized into rather than having to work it out manually in advance.\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/comments/238711412","html_url":"https://github.com/jasminb/jsonapi-converter/issues/64#issuecomment-238711412","issue_url":"https://api.github.com/repos/jasminb/jsonapi-converter/issues/64","id":238711412,"user":{"login":"hndmrsh","id":2135075,"avatar_url":"https://avatars.githubusercontent.com/u/2135075?v=3","gravatar_id":"","url":"https://api.github.com/users/hndmrsh","html_url":"https://github.com/hndmrsh","followers_url":"https://api.github.com/users/hndmrsh/followers","following_url":"https://api.github.com/users/hndmrsh/following{/other_user}","gists_url":"https://api.github.com/users/hndmrsh/gists{/gist_id}","starred_url":"https://api.github.com/users/hndmrsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hndmrsh/subscriptions","organizations_url":"https://api.github.com/users/hndmrsh/orgs","repos_url":"https://api.github.com/users/hndmrsh/repos","events_url":"https://api.github.com/users/hndmrsh/events{/privacy}","received_events_url":"https://api.github.com/users/hndmrsh/received_events","type":"User","site_admin":false},"created_at":"2016-08-09T22:25:09Z","updated_at":"2016-08-09T22:25:09Z","body":"What if there was a method in the ResourceConverter which could be used in conjunction with `readDocument` rather than replaces it (i.e. it returns the Class of the model represented by the byte[] array/input stream)? This way it does not overload the `readDocument` method, so it should not inadvertently encourage users to use it over the existing method.\r\n\r\nAt the moment I am having to do the following to determine the type (which is not ideal):\r\n```\r\nJSONObject jsonObject = new JSONObject(jsonString);\r\nString type = jsonObject.getJSONObject(\"data\").getString(\"type\");\r\n```"}}
{"actor":{"display_login":"hndmrsh"}}