我想我的Json加载到我班JSON GSON.fromJson Java对象
public User() {
this.fbId = 0;
this.email = "";
this.name = "";
this.thumb = "";
this.gender = "";
this.location = "";
this.relationship = null;
this.friends = new ArrayList();
}
{
users:{
user:{
name:'the name',
email:'[email protected]',
friends:{
user:{
name:'another name',
email:'[email protected]',
friends:{
user:{
name:'yet another name',
email:'[email protected]'
}
}
}
}
}
}
}
我努力让GSON用户信息加载到上述Java对象用下面的代码
User user = gson.fromJson(this.json, User.class);
这是XML,JSON不,伙计。 ...好的,你编辑了你的问题。向我们展示JSON!另外,这是一个构造函数,而不是一个类。 – 2011-03-15 16:33:41
对不起有代码段的恶梦lol – Deviland 2011-03-15 16:35:30
阅读http://stackoverflow.com/editing-help。这只是Markdown。 – 2011-03-15 16:36:15