gson解析json 出错

解析方法Gsongson=newGson();child_List=gson.fromJson(json,newTypeToken<List<CommType>>(){}... 解析方法

Gson gson = new Gson();
child_List = gson.fromJson(json,
new TypeToken<List<CommType>>() {
}.getType());
----------------------json数据

[ {"childs": [ { "childs": [],"color": "", "id": "8","name": "中餐", },
{ "childs": [], "color": "", "id": "9", "name": "西餐", }
], "color": "","id": "2", "name": "餐饮美食", }, { "childs": [], "color": "","id": "3", "name": "休闲娱乐", },
{"childs": [], "color": "","id": "4", "name": "便民服务", },
{ "childs": [], "color": "","id": "5","name": "酒店旅游", },
{ "childs": [], "color": "", "id": "6","name": "美容保健", },
{ "childs": [ { "childs": [
{"childs": [],"color": "","id": "12", "name": "项链", } ], "color": "", "id": "10", "name": "服装",},
{"childs": [ { "childs": [],"color": "","id": "13", "name": "帽子",} ], "color": "", "id": "11", "name": "饰品", } ],
"color": "","id": "7", "name": "购物服饰", }
]
---------------------------------类

public static class CHILDS {
private String childs;
private String color;
private int id;
private String name;
private String path;
private int pid;
}
private List<CHILDS> childs;
public List<CHILDS> getChilds() {
return childs;
}
public void setChilds(List<CHILDS> childs) {
this.childs = childs;
}
private String color;
private int id;
private String name;

public String getColor() {
return color;
}
展开
 我来答
匿名用户
2014-06-30
展开全部
childs 这个重复估计不行
家和万事如At
2014-06-29
知道答主
回答量:64
采纳率:0%
帮助的人:22.9万
展开全部
楼主,你好伟大哦~❤
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式