I have an object that I would like to serialize with an attribute in one part of my program, but without in a different part. I also have an ObjectMapper which is extensive
Correct. You can not change mix-ins on-the-fly, however: since they are used for introspection of (de)serializers, and results (actual (de)serializers) are cached, they must be added as part of the initial configuration.
This is why neither ObjectReader
nor ObjectWriter
exposes methods to change mix-ins: they only allow changing of things that can be dynamically changed, on per-call basis.
But perhaps mix-ins are not the best way to do this: have you considered using JSON Views instead? Active view in use can be changed separately for each (de)serialization.