将用户名作为另一个属性,如下所示:
{Users:[{ name: "user1", email: "sth", phone : "sth" }, {name: "user2", email:"sth", phone:"sth"}]}
如果您可以向我们展示 Myclass,提供更多详细信息会有所帮助,但它应该看起来像这样:
public class Myclass [
private List<User> Users;
public List<User> getUsers() {
return Users;
}
public void setUsers(List<User> Users) {
this.Users = Users;
}
}
和
public class User {
private String email;
private String name;
private String phone;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
这将适用于您的代码。