Try and:
mGSON.fromJson(json, new TypeToken<BaseModel<DataClasss>>() {});
See here for more information.
Question
I am using GSON to deserialize a JSON string.
mGSON.fromJson(json, mClass) //mClass == ClassA.class
The problem comes in when using the class below
public class BaseModel<T> {
String StatusCode, Description;
T Data;
}
I'd like to do something like this
mGSON.fromJson(json, mClass<DataClass>);
or
mGSON.fromJson(json, (BaseModel<DataClass>).class);
but obviously this doesn't work.
Solution
Try and:
mGSON.fromJson(json, new TypeToken<BaseModel<DataClasss>>() {});
See here for more information.