gson解析json怎么共用一个类
2016-04-18
展开全部
Type listType = new TypeToken<LinkedList<User>>(){}.getType();
Gson gson = new Gson();
LinkedList<Singer> sing www.hbbz08.com ers = gson.fromJson(jsonData, listType);
for (Iterator iterator = singers.iterator(); iterator.hasNext();) {
Singer singer= iterator.next();
}
public class Singer{
private String name;
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
}
Gson gson = new Gson();
LinkedList<Singer> sing www.hbbz08.com ers = gson.fromJson(jsonData, listType);
for (Iterator iterator = singers.iterator(); iterator.hasNext();) {
Singer singer= iterator.next();
}
public class Singer{
private String name;
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询