{"action":"created","issue":{"url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1309","repository_url":"https://api.github.com/repos/FasterXML/jackson-databind","labels_url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1309/labels{/name}","comments_url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1309/comments","events_url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1309/events","html_url":"https://github.com/FasterXML/jackson-databind/pull/1309","id":167089319,"number":1309,"title":"Failing test demonstating failure JsonTypeInfo for serializing collections","user":{"login":"JWGmeligMeyling","id":3469492,"avatar_url":"https://avatars.githubusercontent.com/u/3469492?v=3","gravatar_id":"","url":"https://api.github.com/users/JWGmeligMeyling","html_url":"https://github.com/JWGmeligMeyling","followers_url":"https://api.github.com/users/JWGmeligMeyling/followers","following_url":"https://api.github.com/users/JWGmeligMeyling/following{/other_user}","gists_url":"https://api.github.com/users/JWGmeligMeyling/gists{/gist_id}","starred_url":"https://api.github.com/users/JWGmeligMeyling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JWGmeligMeyling/subscriptions","organizations_url":"https://api.github.com/users/JWGmeligMeyling/orgs","repos_url":"https://api.github.com/users/JWGmeligMeyling/repos","events_url":"https://api.github.com/users/JWGmeligMeyling/events{/privacy}","received_events_url":"https://api.github.com/users/JWGmeligMeyling/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-22T17:04:15Z","updated_at":"2016-07-22T17:20:21Z","closed_at":"2016-07-22T17:20:21Z","pull_request":{"url":"https://api.github.com/repos/FasterXML/jackson-databind/pulls/1309","html_url":"https://github.com/FasterXML/jackson-databind/pull/1309","diff_url":"https://github.com/FasterXML/jackson-databind/pull/1309.diff","patch_url":"https://github.com/FasterXML/jackson-databind/pull/1309.patch"},"body":"Failing test demonstating failure JsonTypeInfo for serializing collections\r\n\r\nSee also: https://github.com/FasterXML/jackson-databind/issues/1308"},"comment":{"url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/comments/234603166","html_url":"https://github.com/FasterXML/jackson-databind/pull/1309#issuecomment-234603166","issue_url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1309","id":234603166,"user":{"login":"cowtowncoder","id":55065,"avatar_url":"https://avatars.githubusercontent.com/u/55065?v=3","gravatar_id":"","url":"https://api.github.com/users/cowtowncoder","html_url":"https://github.com/cowtowncoder","followers_url":"https://api.github.com/users/cowtowncoder/followers","following_url":"https://api.github.com/users/cowtowncoder/following{/other_user}","gists_url":"https://api.github.com/users/cowtowncoder/gists{/gist_id}","starred_url":"https://api.github.com/users/cowtowncoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cowtowncoder/subscriptions","organizations_url":"https://api.github.com/users/cowtowncoder/orgs","repos_url":"https://api.github.com/users/cowtowncoder/repos","events_url":"https://api.github.com/users/cowtowncoder/events{/privacy}","received_events_url":"https://api.github.com/users/cowtowncoder/received_events","type":"User","site_admin":false},"created_at":"2016-07-22T17:20:21Z","updated_at":"2016-07-22T17:20:21Z","body":"No, not a bug but working as designed, caused by Java Type erasure.\r\n\r\nType information inclusion is based on declared type available at serialization; and due to type erasure, type passed is basically `List<?>`. Elements are only known as `Object`s, which do not add type information (except if default typing is enabled).\r\n\r\nIn general I recommend NOT to serialize generic values as root values (that is, object being serialized should have non-generic type; references via properties can then be generic), to avoid this class of problems.\r\n\r\nBut if you do want to serialize generic Lists (Maps, Pojos), there are 2 work-arounds:\r\n\r\n1. Sub-class to remove genericness; like\r\n\r\n     public class MyTypeList extends ArrayList<MyType> { }\r\n\r\n2. Pass explicit type\r\n\r\n    mapper.writerFor(new TypeReference<List<MyType>>() { })\r\n        .writeValueAsString(list);\r\n\r\nboth of which will give enough information.\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"cowtowncoder"}}