Domain types serialization without depending on annotations from Jackson library. #5453
-
|
Hi all, I have my domain model and I don't want to make it depend on jackson annotations. How do I enable json serialization for my model classes? Do I have to create POJOs for my domain types in the contexts where I want to serialize them or does jackson databind has some facilities to use instead? That is, to enable serialization at the call site. Thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
cowtowncoder
Dec 2, 2025
Replies: 1 comment 6 replies
-
|
@gusega More concrete explanation, preferrably with example would be helpful! |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@gusega You can create differently configured
ObjectWriters fromObjectMapper, so some customization is definitely possible (andObjectReaders for deserialization). You can also create a small number of staticObjectMappers, not just one.As to recommended way: it really depends on usage, users' situation -- we cannot and do not recommend one specific "true" approach. So I guess it's (3). So either (1) or (2) is fine; although TBH Jackson does not necessarily have many ways to accommodate (1).