Can I get a specific variable value from Gson converter without creating a bunch of models?

Viewed 603

If I have a response like that

{
    "data": {
        "main_category": {"user":{"name":"Ali","age":5}}
    }
}

the expected way to get my userModel >>

class User{
    String name;
    int age;
}

class MainCategory{
    User user;
}

class Data{
    MainCategory data;
}

Is there any way to get my user model directly? Like that

class Data{
    @SerializedName("data/main_category/user")
    User user;
}
3 Answers
Related