On Mon, Nov 11, 2019 at 3:39 PM Guido Rost <[email protected]> wrote:
>
> Hello jackson-user group,
>
> I am trying to deserialize the following json string:
>
> String json = 
> "{\"actions\":[[\"set-device-id\",[\"radius-avp\",\"nas-identifier\"]]]}";
>
>
> into the object:
>
> @JsonFormat(shape=JsonFormat.Shape.ARRAY)
>
> @JsonTypeName("set-device-id")
> static public class SetDeviceId extends TransformAction {
>     public RadiusAvp radiusAvp;
>     public SetDeviceId() {}
>
> ...
>
> }
>
>
> Where TransformAction is this:
>
> @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = 
> JsonTypeInfo.As.WRAPPER_ARRAY, property = "name")
> @JsonSubTypes({@JsonSubTypes.Type(TransformAction.SetDeviceId.class),...)}
> @JsonTypeName("transform-action")
> public abstract class TransformAction {
>
> ...
>
> }
>
>
> and RadiusAvp is:
>
> @JsonTypeName("radius-avp")
> public class RadiusAvp {
>
>     public String attribute;
>
>     public RadiusAvp(String attribute) {
>         this.attribute = attribute;
>     }
>
> ...
>
> }
>
>
> Doing this jackson errors:
>
>
> Unexpected token (VALUE_STRING), expected START_ARRAY: need JSON Array to 
> contain As.WRAPPER_ARRAY type information for class RadiusAvp at [Source:
>
>
> Is there any way of deserializing the provided json into SetDeviceId. I 
> understand that Jackson doesn't seem to know about the RadiusAvp type since I 
> provide no assignment to the SetDeviceId.radiusAvp field. Is there some 
> Jackson annotation which is missing or wrong

I think I am missing something: what is the exact main level call to
readValue(): specifically, what is its target type? (I do not see any
class with property "actions" which must exist to match JSON Object)

-+ 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/CAL4a10g-J8eQNC8NAH2vkvZg1Cej1WbBvsFzo7gL2tp0J%3DS3Fw%40mail.gmail.com.

Reply via email to