On Mon, Apr 22, 2019 at 10:28 AM doug.tarr via jackson-user
<[email protected]> wrote:
>
> I have an object that looks like so:
>
> {
>
>    "add" : {  ...}
> }
>
> {
>
>     "subtract" : {  ...}
> }
>
>
> Add and Subtract are both subclasses of an abstract Operator class and are 
> set up as JsonSubTypes
>
> @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = 
> JsonTypeInfo.As.WRAPPER_OBJECT)
> @JsonSubTypes(
>
> This works correctly until I add a second key:
> {
>
>    "add" : {  ...},
>    "foo" : 1
> }
>
> {
>
>     "subtract" : {  ...},
>    "foo" : 1
> }
>
> At which point I see:  "Invalid type definition for type `MyObj`: Argument #0 
> has no property name, is not Injectable: can not use as Creator [constructor 
> for MyObj annotations: {interface 
> com.fasterxml.jackson.annotation.JsonCreator=@com.fasterxml.jackson.annotation.JsonCreator(mode=DEFAULT)}]
>
> Is there anyway to continue to use a Wrapper object but also have multiple 
> keys?

I think you need to give us your full class definition, and JSON you
hope to Map. I can't quite follow the description to understand what
exactly you mean: full definition would help.

-+Tatu +-

-- 
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