문제

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