Gson错误UnsupportedOperationException

时间:2017-11-22 09:07:04

标签: android gson

这是我从服务器获得的json响应:

[{
    "Address": null,
    "CreateDate": "\/Date(1507113156710+0330)\/",
    "Email": null,
    "FirstName": "sa1",
    "Id": "f3557b7f-359c-438a-99fd-da924ff9041f",
    "JobLocation": null,
    "LastName": "ss",
    "Mobile": null,
    "Sex": 0,
    "Tel": null,
    "UserName": "sa1"
}, {...

这是我的pojo课程:

public class Suser implements Serializable {

private String Address;
private String CreateDate;
private String Email;
private String FirstName;
private String LastName;
private String UserName;
private String Id;
private String JobLocation;
private String Mobile;
private String Sex;
private String Tel;

但是当我从我的服务器获取数据并使用Gson转换时,我收到了这个错误:

Error during class com.musers.fragment.UsersFragment$GeneratedEvaluationClass$1 definition: com.intellij.debugger.engine.evaluation.EvaluateException: Method threw 'java.lang.UnsupportedOperationException' exception.

这是我使用GSON的代码:

List<Suser> susers= GsonUtil.createGson().fromJson(response,
            new TypeToken<List<Suser>>() {}.getType());

某些字段为空,我认为我的问题是针对该问题。我可以解决这个问题吗?谢谢

0 个答案:

没有答案