I am using Restlet to call an API that returns a JSON Array of objects. When making a similar call to pull back a single object, everything gets mapped correctly to the custom class, but when I pull back the array the Object is getting mapped as a LinkedHashMap instead of this custom object. I'm sure I just need to define how to deserialize the array correctly, but I haven't figured out exactly how to do that.
@Get("json")
public Trait getTrait();
@Get("json")
public HashSet<Trait> getTraits();
The former works fine, but the latter isn't work. Ultimately when I try to iterate through the HashSet I can this error: java.util.LinkedHashMap cannot be cast to com.test.traits.Trait.
Any help would be appreciated.