'What is the equivalent for @XmlAnyElement in JSON/JACKSON
I'm using jackson and I have a problem with the method returning the Object object. This means that different classes can be passed in .json file and I want to parse them to the corresponding object from my project.
@XmlAnyElement (lax = true)
public Object getEntity() {
return this.entity;
}
I always get LinkedHashMap in return since JSON isn't sure what object should it expect.
Is it possible to annotate the method with the list of expected class names?
Is it possible to annotate the method with the list of expected objects that should be returned?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
