johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <>
Subject Re: Arrays / Lists elements polymorphic support
Date Wed, 18 Apr 2018 17:35:21 GMT
Hi Roberto

Yes, an adapter is the way to go using our mapper or jsonb.

There should be an "animal" test showing how to do that. Just dont forget
to use class aliases or a whitelist logic to not open a backdoor.

Since the model doesnt match the java model im not a fan of that feature
being built out of the box. In xml it is more natural but in json you can
do it without breaking the model. For me it means the model is broken and
must not be used as an input.

Le 18 avr. 2018 19:31, "Roberto Cortez" <> a
écrit :

> Hi guys,
> I'm trying to serialize a list of elements of multiple types and then
> deserialize it again. It does require to somehow include the type in the
> serialization result to know to which type we should map to deserialize. I
> think this could possible be done with an Adapter and playing with the
> JsonArray.
> I was just wondering if there any kind of out of the box support for this.
> It doesn't seem so, at least I was not able to find.
> Jackson for instance, includes a set of annotations that allow you to do
> exactly this, without any extra / custom code.
> Any thoughts?
> Thank you.
> Cheers,Roberto

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message