Replies: 1 comment 1 reply
-
Hi, the reason to bind early is for performance - Jackson will re-use the information it has about the type in the Writer. If you need to select the writer dynamically based on the runtime type of the value, that is fine to do, but the default implementation does it based on the static type given to it for performance reasons. We could consider making this configurable, or including both types of json mapping out of the box, if other users want to do this too. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
JacksonJsonMapper
serializes based on the call site type. i.e. the mapper is allocated when theTypedJsonMapper
is returned (writer = mapper.writerFor(mappedType);
). However, whentoJson()
is called the value might be a sub-type of the call site and require a different serializer in theObjectMapper
. I'm planning on using a customJsonMapper
. Do you see any issues with this design?Beta Was this translation helpful? Give feedback.
All reactions