-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add JsonMapper
to replace generic ObjectMapper
usage
#2153
Comments
This is more speaking than using the generic ObjectMapper here, also see FasterXML/jackson-databind#2153. Signed-off-by: Sebastian Schuberth <[email protected]>
This is more speaking than using the generic ObjectMapper here, also see FasterXML/jackson-databind#2153. Signed-off-by: Sebastian Schuberth <[email protected]>
This is more speaking than using the generic ObjectMapper here, also see FasterXML/jackson-databind#2153. Signed-off-by: Sebastian Schuberth <[email protected]>
hi @cowtowncoder , i'm wondering if there's a straight forward way to copy an already configured Use case is I have an autoconfigured |
Try looking for some sort of copy method in ObjectMapper @IEnoobong |
@JooHyukKim thanks, there's one but it doesn't return a |
Just cast it: return type of But also note that as things are, there is no additional functionality in Also: if your reference is to If question is on creating |
Thanks @cowtowncoder I did this public JsonMapper httpObjectMapper() {
var copy = (JsonMapper) objectMapper.copy();
return copy.rebuild()
.propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS)
.enable(EnumFeature.WRITE_ENUMS_TO_LOWERCASE)
.build();
} But getting this error
|
Ok, please file an issue with full reproduction and I can have a look. I suspect it is the Note, too, that you need NOT use
|
Cannot reproduce the issue with 2.17, fwtw. |
@cowtowncoder thanks for your response, the issue rather is |
I see what your problem is now. I don't see direct way of copying. |
No. Next time please include some code so we can actually evaluate what you are trying to do -- that makes misunderstandings less likely. |
@JooHyukKim No; I thought about that in the past, but things get rather complicated quickly in 2.x, wrt configuration. It would be very difficult to ensure everything is properly copied. We could consider this for 3.0 where things are bit cleaner as |
Due to problems with trying to override builder factory for
ObjectMapper
, and introduction of JSON-specific format features (JsonReadFeature
,JsonWriteFeature
), it is necessary to introduce separateJsonMapper
, to be used instead ofObjectMapper
.With this (and related Smile, CBOR additions), there will now be format-specific mapper subtype for all formats.
ObjectMapper
will still exist, and may even be instantiated (more so with 2.10, less with 3.x), but usage should move over to specific mappers for 3.x.The text was updated successfully, but these errors were encountered: