public class ListResult<T> { private boolean ok; private String message; private java.util.List<T> data; private Paging paging; }
When i want to deserializ_Stack Overflow中文网
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
When i want to deserializ
Type fooType = new TypeToken<ListResult<StringMap>>() {}.getType(); Gson gson = new Gson(); ListResult<StringMap> model = gson.fromJson(strResult, fooType);
Gson无法读懂您的想法,也无法自行确定通用类型;)
Gson
https://sites.google.com/site/gson/gson-user-guide#TOC-Serializing-and-Deserializing-Generic-Types
只是不要使用列表,使用数组 MyObj[] myObjs。不需要使用 TypeToken 方式
MyObj[] myObjs