Google Gson - deserialize list<class> object

来源:互联网 发布:python map数据结构 编辑:程序博客网 时间:2024/06/06 14:24

Method to deserialize generic collection:

Type listType = new TypeToken<ArrayList<YourClass>>(){}.getType();List<YourClass> yourClassList = new Gson().fromJson(jsonArray, listType);

Import : import java.lang.reflect.Type;

0 0
原创粉丝点击