Frage

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 {
 // ...
}
War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top