I believe the “right way” to do serialization and deserialization is a “type class based” approach, like what Aeson does. Unfortunately the community hasn’t given us one in the Java-land. Jackson is a widely (?) used JSON serialization libary. Unfortunately it has a few problems, but the good thing is that it provides some ways to make it more tolerable.
Java client codegen for Swagger doesn’t support everything out of the box, but it seems to be extensible.