Hi everyone! When serializing entity with many references to another same entity, if that entity marked @JsonIdentityInfo, first occurence of entity serialized as full entity, other occurrences are serialized as id. Its work. I need to serialize entities with type information, so I use polymorphic type handler.
I created test project: https://github.com/alex-t0/deserialization-fail-example.git Please see this classes: 1. User - https://github.com/alex-t0/deserialization-fail-example/blob/master/src/main/java/deserialization/fail/example/User.java 2. UserPair - https://github.com/alex-t0/deserialization-fail-example/blob/master/src/main/java/deserialization/fail/example/UserPair.java 3. MapperUtil - https://github.com/alex-t0/deserialization-fail-example/blob/master/src/main/java/deserialization/fail/example/MapperUtil.java 4. UserSerializationTest - https://github.com/alex-t0/deserialization-fail-example/blob/master/src/test/java/deserialization/fail/example/UserSerializationTest.java Serialization works as I expect: [ "deserialization.fail.example.UserPair", { "user1": [ "deserialization.fail.example.User", { "id": [ "java.lang.Long", 42 ], "login": "aaa" } ], "user2": 42 } ] Second occurence is integer value 42. But when deserializing I get this exception: com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected token (VALUE_NUMBER_INT), expected START_ARRAY: need JSON Array to contain As.WRAPPER_ARRAY type information for class java.lang.Long at [Source: (String)"["deserialization.fail.example.UserPair",{"user1":["deserialization.fail.example.User",{"id":["java.lang.Long",42],"login":"aaa"}],"user2":42}]"; line: 1, column: 140] (through reference chain: deserialization.fail.example.UserPair["user2"]) So, jackson not understand user2 value as integer. Is is my improper use/misconfiguration? Or it is a bug? Workaround? -- 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/97beb379-b4ca-4543-8e6b-069da57c4fe3%40googlegroups.com.
