Open ariens opened 8 years ago
In this situation we changed writer to add 'type' field that captures the concrete type and use this information at deserialization time. I would be curious too to see whether there are more elegant ways to solve this problem.
Looking for some best practices for dealing with a use case that involves serialization and deserialization of an object hierarchy that based off an abstract class. I have the serialization working as expected but currently no good method for determining the appropriate class to use for deserialization. The only approach I can envision is to a) not allow deserialization (throwing the exception as per the below) or determining if the value can be made into an int, then long, then float, then double (but that would likely be terribly inefficient). Can anyone recommend a best practice using spray-json?