2

我有一个从 Web 服务调用返回的 JSON 对象,如下所示:

{"responseData":{"results":[{
    "mothraId":null,
    "studentId":null,
    "bannerPIdM":null,
    "externalId":null,
    "dFirstName":null,
    "dFullName":null,
    "dLastName":null,
    "dMiddleName":null,
    "modifyDate":"2012-02-24 06:24:33",
    "oFirstName":"Joe",
    "oFullName":"Joe R Smith",
    "oLastName":"Smith",
    "oMiddleName":"R",
    "iamId":"999999999",
    "ppsId":"999999999",
    "oSuffix":null,
    "dSuffix":null,
    "isEmployee":null,
    "isHSEmployee":null,
    "isFaculty":"N",
    "isStudent":"N",
    "isStaff":"N",
    "isExternal":"N",
    "privacyCode":null}]},
"responseStatus":0,
"responseDetails":""}

我正在尝试使用以下内容将 JSON 字符串反序列化为对象:

ReturnObject allInOne = js.Deserialize<ReturnObject>(jsonResponse);

ReturnObject 定义如下:

public class ReturnObject
{
    public String responseDetails { get; set; }
    public String responseCode { get; set; }
    public ResponseData responseData { get; set; }

    public class ResponseData
    {
        public List<PeopleResult> results { get; set; }

        public class PeopleResult{

            String iamId { get; set; }
            String mothraId { get; set; }
            String ppsId { get; set; }
            String studentId { get; set; }
            String bannerPIdM { get; set; }
            String externalId { get; set; }
            String oFirstName { get; set; }
            String oMiddleName { get; set; }
            String oLastName { get; set; }
            String oFullName { get; set; }
            String oSuffix { get; set; }
            String dFirstName { get; set; }
            String dMiddleName { get; set; }
            String dLastName { get; set; }
            String dSuffix { get; set; }
            String dFullName { get; set; }
            String isEmployee { get; set; }
            String isHSEmployee { get; set; }
            String isFaculty { get; set; }
            String isStudent { get; set; }
            String isStaff { get; set; }
            String isExternal { get; set; }
            String privacyCode { get; set; }
            String modifyDate { get; set; }
        }
    }

不幸的是,除了 List 结果中的单个 PeopleResult 对象的内容之外,我得到了所有内容。PeopleResult 中所有属性的值为空。ReturnObject 类的结构或命名是否有问题?

4

1 回答 1

1

PeopleResult 类中的所有属性都不是公共的。

于 2012-04-05T22:33:14.200 回答