You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm serializing and deserializing a list including two objects, with circular references there.
//Using latest version for the dependencies//jackson.version = 2.13.1//jackson-jsog = 1.1.2@NoArgsConstructor@JsonIdentityInfo(generator = JSOGGenerator.class)
publicstaticclassOuter {
@Setter@GetterprivateInnerinner;
}
@NoArgsConstructor@JsonIdentityInfo(generator = JSOGGenerator.class)
publicstaticclassInner {
@GetterprivateOuterouter;
publicInner(Outerouter) {
this.outer = outer;
outer.setInner(this);
}
}
publicstaticvoidmain(String[] args) throwsException {
// There are circular references between Outer and InnerOuterouter = newOuter();
Innerinner = newInner(outer);
// Turn on type infoPolymorphicTypeValidatorptv = BasicPolymorphicTypeValidator.builder().allowIfSubType(Object.class).build();
ObjectMappermapper = newObjectMapper()
.activateDefaultTyping(ptv, ObjectMapper.DefaultTyping.EVERYTHING,
JsonTypeInfo.As.PROPERTY);
List<Object> source = Lists.newArrayList(outer, inner);
Stringjson = mapper.writeValueAsString(source);
System.out.println(json);
//This is the json serialized by JSOGGenerator, which does make sense//See belowList<Object> target = mapper.readerForListOf(Object.class).readValue(json);
//However, I got an InvalidTypeIdException while deserializing//Exception in thread "main" com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve subtype of [simple type, class com.voodoodyne.jackson.jsog.JSOGRef]: missing type id property '@class'
}
This is the json serialized by JSOGGenerator, which does make sense.
I'm serializing and deserializing a list including two objects, with circular references there.
This is the json serialized by JSOGGenerator, which does make sense.
However, I got an
InvalidTypeIdException
while deserializing.And I found the property "@id" is not handled correctly.
See
ObjectIdValueProperty._valueDeserializer._baseType
, which type isJSOGRef
and it can not parse "1"(String) as object id value.The text was updated successfully, but these errors were encountered: