-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Please provide a way to clone an ObjectMapper #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Right, 2.0 sort of hides access to serialization/deserialization config objects. |
ObjectMapper o1= objectMapper.clone().configure(SerializationFeature.INDENT_OUTPUT)); or Both seem reasonable to me :) |
Right, those seem like obvious choices. I may ask others on dev list for their input just for fun. |
Implemented as 'ObjectMapper.copy()'. Required quite a bit more work than I expected; had to add JsonFactory.copy() as well, tested etc. But should work more reliably than the old method, as well; i.e. copy all state, unshare. |
Add some useful badges with automatic version detection: Maven and Javadoc
We need a way to clone an ObjectMapper. The user case is:
At some times we need a ObjectMapper which has a slightly different configuration that the one that we use though the system.
In Jackson 1.9.1 we did this by
ObjectMapper o1= new ObjectMapper()
.setSerializationConfig(objectMapper.getSerializationConfig()
.with(SerializationConfig.Feature.INDENT_OUTPUT));
I couldn't find a way to reproduce this in Jackson 2.
We cannot use ObjectReader/ObjectWriter for this, since we use both databinding and the TreeModel and ObjectWriter doesn't have support for TreeModel.
The text was updated successfully, but these errors were encountered: