سؤال

We have a POJO that always have worked to be marshalled with Jackson however for one instance it failed. What could be the theoretical reason that this @class would be missing in the output JSON document.

Missing:

"@class": "com.comp.models.shared.Document"

on

@JsonTypeInfo(use=org.codehaus.jackson.annotate.JsonTypeInfo.Id.CLASS)
public class Document {
 // ...
}
هل كانت مفيدة؟

المحلول

The answer probably depends on which version of Jackson you are using (looks like it might be an older version if you're still using the codehaus package structure) and if it's intermittent, probably has to do with the types of the items in lists or maps contained in the object.

There's a defect that was open with something similar. This might be your bug if you're using a version older than 2.3.0

https://github.com/FasterXML/jackson-databind/issues/234

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top