嗨,感谢这个美妙的工具!
我有一个 JSON 响应,它为“帐户”返回一些“文件夹”。我使用http://json2csharp.com/来生成将结果序列化到的类。这些类位于此 JSON 之下。
简而言之,问题是返回了正确的文件夹,并创建了数组,但是数组成员(文件夹)的成员变量从未初始化。
{ “名称”:“SEResponse”, "declaredType": "com.sesac.api.view.FolderList", "范围": "javax.xml.bind.JAXBElement$GlobalScope", “价值”: { “关联”: [], “总记录”:9, “文件夹”:[ { “文件夹”: { “文件夹ID”:1, “帐户ID”:1, “名称”:“根”, “isRoot”:是的, “父ID”:0, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } }, { “文件夹”: { “文件夹ID”:9, “帐户ID”:1, “名称”:“m4”, “是根”:假, “父ID”:1, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } }, { “文件夹”: { “文件夹ID”:2, “帐户ID”:1, “名称”:“c1”, “是根”:假, “父ID”:1, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } }, { “文件夹”: { “文件夹ID”:3, “帐户ID”:1, “名称”:“c2”, “是根”:假, “父ID”:1, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } }, { “文件夹”: { “文件夹ID”:4, “帐户ID”:1, “名称”:“cc2”, “是根”:假, “父ID”:3, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } }, { “文件夹”: { “文件夹ID”:5, “帐户ID”:1, “名称”:“dd2”, “是根”:假, “父ID”:3, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } }, { “文件夹”: { “文件夹ID”:10, “帐户ID”:1, “名称”:“z4”, “是根”:假, “父ID”:1, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } }, { “文件夹”: { “文件夹ID”:6, “帐户ID”:1, “名称”:“z2”, “是根”:假, “父ID”:1, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } }, { “文件夹”: { “文件夹ID”:7, “帐户ID”:1, “名称”:“j4”, “是根”:假, “父ID”:1, “父名”:空, “创建日期”:空, "lastModifiedDate": null, “fbFolderId”:空, “fbParentId”:空 } } ] }, “无”:假, “全球范围”:真, “类型替换”:假 }
这是我的课程:
public class Folder
{
public int folderId { get; set; }
public int accountId { get; set; }
public string name { get; set; }
public bool isRoot { get; set; }
public int parentId { get; set; }
public object parentName { get; set; }
public object creationDate { get; set; }
public object lastModifiedDate { get; set; }
public object fbFolderId { get; set; }
public object fbParentId { get; set; }
}
public class FolderList
{
public List<object> link { get; set; }
public int TotalRecords { get; set; }
public List<Folder> Folders { get; set; }
}
public class RootFolderObject
{
public string name { get; set; }
public string declaredType { get; set; }
public string scope { get; set; }
public FolderList value { get; set; }
public bool nil { get; set; }
public bool globalScope { get; set; }
public bool typeSubstituted { get; set; }
}