At the moment I can not think of a better way. Adding wrapping/unwrapping
from Jackson side has proven a thorny issue, not so much for simple use
cases (... well, most cases end up not being simple anyway), but in
combination with things like polymorphic handling, type ids and
JsonCreator/JsonValue annotations.
Adding root-level wrapping itself could be tweakable, but there is no
mechanism for doing wrapping and adding siblings.

About the only thing I can think of that might be helpful would be
"converting " serializers/deserializers, which could allow bit easier
handling, but not sure they would work for your specific use case.

-+ Tatu +-



On Tue, Aug 16, 2016 at 8:49 AM, Karl the Pagan <[email protected]>
wrote:

> At this point I don't see a way to achieve wrapping with a root POJO using
> BeanSerializerModifier so I'm committed to the course of extending
> DefaultSerializerProvider. This means that I have to bootstrap when I
> create my ObjectMappers rather than by defining a module.
>
> -karl
>
>
> On Sunday, August 14, 2016 at 10:09:30 PM UTC-7, Karl the Pagan wrote:
>>
>> I'm looking into different ways of supporting json-api and json-ld models
>> in Spring (specifically building on spring-hateoas).
>>
>> My current json-api investigation has lead me to favor serializing and
>> deserializing model types directly and wrapping them as needed. I am
>> looking for the simplest recommendation of wrapping a root element in a
>> POJO.
>>
>> At the moment I am extending DefaultSerializerProvider and
>> DefaultDeserializationContext in order to wrap the root element (for
>> serializers) / replace the root JavaType (for deserializers). The
>> replacement can then be the target of mixins. Work in progress:
>> https://github.com/karlthepagan/jackson-examples/blob/
>> develop/src/main/java/karl/codes/jackson/JsonWrap.java
>>
>> Does anyone have a suggestion for a simpler or more elegant approach?
>>
>> -karl
>>
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to