I am using a library that creates an ObjectMapper
and adds some Module
s of its own to this mapper. I would like the serializers in these modules to pretty print. However, my only access to configure this mapper is via a builder that lets me add my own modules. Can I use my ability to add modules to the ObjectMapper
to configure it to pretty print? I'm not seeing any methods or properties of SimpleModule
suggesting that I can.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Yes, if you can register a
Module
with anObjectMapper
, you can manipulate the mapper. Override thesetupModule()
method on theModule
and then usegetOwner()
on theModule.SetupContext
that you get:The documentation for
getOwner()
suggests you shouldn't do this unless you have to.