1 首先根据json串 ,构建javabean
public class NewsCenter { public Listdata; public List extend; public String retcode; public class NewsCenterItem { public List children; public String id; public String type; public String title; public String url; public String url1; public String dayurl; public String excurl; public String weekurl; } public class Children { public String id; public String type; public String title; public String url; }}
2 编写一个json工具类
public class GsonUtil {public staticT json2bean(String json,Class clazz){ Gson gson=new Gson(); return gson.fromJson(json, clazz); }}
3 解析json
NewsCenterPager centerPager=GsonUtil.json2bean(result, NewsCenterPager.class);