Issue
I am just simply trying to use retrofit to perform my rest api calls. The issue that I am facing is that when parsing the json, some of the key fields contain dots. For example:
{ "data": { "name.first": "first name"} }
Is it possible to configure Retrofit (or GsonConverter) to be able to handle this and how do I go about doing so?
Solution
This is neither Retrofit nor the GsonConverter's responsibility but rather Gson which sits underneath doing the actual JSON (de)serialization.
You can use Gson's @SerializedName
annotation to work around names which cannot be represented in Java:
@SerializedName("name.first")
public final String firstName;
Answered By - Jake Wharton
Answer Checked By - Willingham (JavaFixing Volunteer)