Using Retrofit and RxJava, how do I deserialize JSON when it doesn't map directly to a model object?
问题 The API I'm working with returns objects (and their containing objects) in a "flat" format and I'm having trouble getting this to work elegantly with Retrofit and RxJava. Consider this JSON response for an /employees/{id} endpoint: { "id": "123", "id_to_name": { "123" : "John Doe" }, "id_to_age": { "123" : 30 } } Using Retrofit and RxJava, how do I deserialize this to a Employee object with fields for name and age ? Ideally I'd like RxJava's onNext method to be called with an Employee object.