{"action":"created","issue":{"url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1111","labels_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1111/labels{/name}","comments_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1111/comments","events_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1111/events","html_url":"https://github.com/dropwizard/dropwizard/issues/1111","id":86648631,"number":1111,"title":"Allow better customization of Jackson ObjectMapper","user":{"login":"vzx","id":11522720,"avatar_url":"https://avatars.githubusercontent.com/u/11522720?v=3","gravatar_id":"","url":"https://api.github.com/users/vzx","html_url":"https://github.com/vzx","followers_url":"https://api.github.com/users/vzx/followers","following_url":"https://api.github.com/users/vzx/following{/other_user}","gists_url":"https://api.github.com/users/vzx/gists{/gist_id}","starred_url":"https://api.github.com/users/vzx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vzx/subscriptions","organizations_url":"https://api.github.com/users/vzx/orgs","repos_url":"https://api.github.com/users/vzx/repos","events_url":"https://api.github.com/users/vzx/events{/privacy}","received_events_url":"https://api.github.com/users/vzx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-09T16:00:33Z","updated_at":"2015-06-12T11:58:51Z","closed_at":null,"body":"Currently the only way to customize the Jackson `ObjectMapper` is either through the `io.dropwizard.Application#initialize` method's `bootstrap` parameter (using `bootstrap.getObjectMapper()`) , or the `io.dropwizard.Application#run` method's `environment` parameter (using `environment.getObjectMapper()`).\r\nHowever in these cases, the `ObjectMapper` is already fully initialized using some default modules and settings, and there is no way for Jackson to remove modules from the `ObjectMapper`.\r\n\r\nFor example, I'm having a very strange issue with the `AfterburnerModule` and since I'm unable to make a reproducible test case for it, I just want to disable it (I don't need this module at all).\r\n\r\nSimilarly, I might want to configure the `JodaModule` using a different date format, which is also not possible right now.\r\n\r\nAs such it would be nicer if in the `initialize` method the `Bootstrap` exposes some builder which you can add to, but also remove from, and the final `ObjectMapper` is then built using the settings of this builder. This will allow users to for example remove undesired modules, or reconfigure existing modules by overwriting them with a new configuration.\r\n\r\nOr perhaps there could be some configuration settings to indicate how the `ObjectMapper` should be configured.\r\n"},"comment":{"url":"https://api.github.com/repos/dropwizard/dropwizard/issues/comments/111468364","html_url":"https://github.com/dropwizard/dropwizard/issues/1111#issuecomment-111468364","issue_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/1111","id":111468364,"user":{"login":"vzx","id":11522720,"avatar_url":"https://avatars.githubusercontent.com/u/11522720?v=3","gravatar_id":"","url":"https://api.github.com/users/vzx","html_url":"https://github.com/vzx","followers_url":"https://api.github.com/users/vzx/followers","following_url":"https://api.github.com/users/vzx/following{/other_user}","gists_url":"https://api.github.com/users/vzx/gists{/gist_id}","starred_url":"https://api.github.com/users/vzx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vzx/subscriptions","organizations_url":"https://api.github.com/users/vzx/orgs","repos_url":"https://api.github.com/users/vzx/repos","events_url":"https://api.github.com/users/vzx/events{/privacy}","received_events_url":"https://api.github.com/users/vzx/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T11:58:51Z","updated_at":"2015-06-12T11:58:51Z","body":"@mattnelson Thank you for your suggestion. However, the `JodaModule` does not seem to respect this setting. Image this small test code snippet:\r\n\r\n```java\r\nObjectMapper om = new ObjectMapper()\r\n        .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)\r\n        .setDateFormat(new SimpleDateFormat(\"YYYY-MM-dd\"))\r\n        .registerModule(new JodaModule());\r\n\r\nString s = om.writeValueAsString(new Object() {\r\n    public DateTime d = new DateTime();\r\n});\r\n\r\nSystem.out.println(s);\r\n```\r\n\r\nThis outputs: `{\"d\":\"2015-06-12T11:58:53.775Z\"}`. Possibly, this is a bug in the `JodaModule` and should be reported there."}}