Q:

Unable to use POJO class to get the token and save into a string

I am getting the data from the API and then I am converting it to the String so that I can use my POJO classes(User and Token) to save the data into sharedPref. I am able to use the methods of User class but whenever I try to access the method of class Token the app crashes.
Here is my response that I am getting:
{
"username": "string",
"email": "string",
"firstName": "string",
"lastName": "string",
"avatarURL": "string",
"token": {
  "token": "string",
  "expiresOn": "2019-06-29T21:07:07.891Z"
}}

Here is my User Class:
public class User {
public User() {
}

@SerializedName("username")
@Expose
private String username;
@SerializedName("email")
@Expose
private String email;
@SerializedName("firstName")
@Expose
private String firstName;
@SerializedName("lastName")
@Expose
private String lastName;
@SerializedName("avatarURL")
@Expose
private String avatarURL;
@SerializedName("token")
@Expose
private Token token;

public String getUsername() {
    return username;
}

public void setUsername(String username) {
    this.username = username;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

public String getFirstName() {
    return firstName;
}

public void setFirstName(String firstName) {
    this.firstName = firstName;
}

public String getLastName() {
    return lastName;
}

public void setLastName(String lastName) {
    this.lastName = lastName;
}

public String getAvatarURL() {
    return avatarURL;
}

public void setAvatarURL(String avatarURL) {
    this.avatarURL = avatarURL;
}

public Token getToken() {
    return token;
}

public void setToken(Token token) {
    this.token = token;
}}

Here is my Token Class:
public class Token {
public Token() {
}

@SerializedName("token")
@Expose
private String token;
@SerializedName("expiresOn")
@Expose
private String expiresOn;

public String getToken() {
    return token;
}

public void setToken(String token) {
    this.token = token;
}

public String getExpiresOn() {
    return expiresOn;
}

public void setExpiresOn(String expiresOn) {
    this.expiresOn = expiresOn;
}}

Function from which I am requesting:
public void logInRequest(final String userName, String userPassword) {
    final JSONObject jsonObject = new JSONObject();
    try {

        jsonObject.put("identifier", userName);
        jsonObject.put("password", userPassword);

    } catch (JSONException e) {
        e.printStackTrace();
    }
    APIService apiService = RetrofitClient.getAPIService();
    Call<String> logInResponse = apiService.logIn(jsonObject.toString());
    logInResponse.enqueue(new Callback<String>() {
        @Override
        public void onResponse(Call<String> call, Response<String> response) {
            if (response.message().equals("OK")) {
                String data = response.body();

                Gson g = new Gson();
                Gson g1 = new Gson();
                User user = g.fromJson(data, User.class);
                Token token=g1.fromJson(data,Token.class);

                String tokenNo=token.getToken();
                String username = user.getUsername();
                String email = user.getEmail();
                String firstName = user.getFirstName();
                String lastName = user.getLastName();

                sharedPrefs.saveUserName(username);
                sharedPrefs.saveEmail(email);
                sharedPrefs.saveFullName(firstName, lastName);

                context.startActivity(new Intent(context, HomeActivity.class));
            } else {
                Toast.makeText(getApplication(), "Wrong User Name or Password", Toast.LENGTH_SHORT).show();
            }

        }

        @Override
        public void onFailure(Call<String> call, Throwable t) {
            Toast.makeText(getApplication(), "Something went wrong please try again", Toast.LENGTH_SHORT).show();

        }
    });

}

I have used the inbuilt debugger and the app crashes on this line 
Token token=g1.fromJson(data,Token.class);

A:

User user = g.fromJson(data, User.class);

// Try this to get the token of a particular user.
// I think this may be the cause of the error.
Token token = user.getToken();

String tokenNo = token.getToken();      

