Answer the question
In order to leave comments, you need to log in
Retrofit How to map fields from JSON response to non-matching model fields?
Suppose the web service returns a JSON user object: {"user_ig"="32432", "user_name"="Ivan"}
I use Retrofit and GSON and having a User class with fields 'user_id' and 'user_name' I get the parsed object without problems.
But what should I do if I do not want the field names of my model to depend on a third-party service:
Class User {
public id;
public name;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question