Re: Partial JSON deserialization
toggle quoted messageShow quoted text
Thanks for this. I had considered this approach … but then I have to handle the map elements manually. And if the attribute defining the polymorphic type is outside the object itself, in some outer JSON then the adapter approach does not work.
I really want to specify that the JSON for the polymorphic object is left as raw JSON text. Then I can get the outer object using Jsonb, examine its attributes and then apply the Jsonb again to the raw string with the correct target class.
From: Andy Guibert [mailto:andy.guibert@...]
Sent: 31 January 2018 14:38
Subject: Re: [jsonb-spec] Partial JSON deserialization
A JsonbAdapter can go between Map<String, ?> and the java type it's an adapter for. In the `adaptFromJson(Map<String,?>)` method you can handle polymorphism yourself if needed. We do this in one of our test cases for OpenLiberty for example: