I want to use the Google Gson library to (de)serialize a parameterized type that has a parameterized member field.
The class looks like this:
public class Foo<T>{
List<T> bar;
}
How do I go about this?
I tried using a TypeToken
like so:
Type type = new TypeToken<Foo<String>>() {}.getType();
gson.fromJson<Foo<String>>(json, type);
This throws an IllegalStateException