Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 不带任何属性名称的json的DTO_C#_Json_Restsharp - Fatal编程技术网

C# 不带任何属性名称的json的DTO

C# 不带任何属性名称的json的DTO,c#,json,restsharp,C#,Json,Restsharp,我试图使用RestSharp来反序列化不包含属性名的json数据。返回的数据的顺序和类型与基于请求参数的预定义顺序相匹配 以下是响应数据的外观: { "pos": 0, "start": 0, "totalRecords": 2, "data": [ [ "bdb4b591-482e-43a5-86c8-00c9e4b913df", null, null,

我试图使用RestSharp来反序列化不包含属性名的json数据。返回的数据的顺序和类型与基于请求参数的预定义顺序相匹配

以下是响应数据的外观:

{
    "pos": 0,
    "start": 0,
    "totalRecords": 2,
    "data": [
        [
            "bdb4b591-482e-43a5-86c8-00c9e4b913df",
            null,
            null,
            "SOUTH LAWN",
            0,
            300,
            "fffde79d-68b2-4825-aaac-9be4d03e7d13",
            true,
            "2014-07-01T17:33:37.727",
            1
        ],
        [
            "4980578e-5663-44c3-aed3-0151b085dc11",
            "125",
            "POLICE ACADEMY #",
            "125",
            634,
            32,
            "f6439406-6c74-455d-9d70-7540b514c651",
            true,
            "2014-12-04T14:50:37.707",
            3
        ]
]}
下面是表示数据项的DTO类:

public class RoomEntity
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public string RoomNumber { get; set; }
    public float SquareFootage { get; set; }
    public int MaxOccupancy { get; set; }
    public string BuildingId { get; set; }
    public bool IsActive { get; set; }
    public DateTime ModifiedDate { get; set; }
    public int RowVersion { get; set; }
}
    public class QueryResponse<TEntity>
{
    public int Pos { get; set; }
    public int Start { get; set; }
    public int TotalRecords { get; set; }
    public List<TEntity> Data { get; set; }
}
公共类RoomEntity
{
公共字符串Id{get;set;}
公共字符串名称{get;set;}
公共字符串说明{get;set;}
公共字符串RoomNumber{get;set;}
公共浮点数{get;set;}
公共int maxOccupation{get;set;}
公共字符串BuildingId{get;set;}
公共bool IsActive{get;set;}
公共日期时间修改日期{get;set;}
公共int行版本{get;set;}
}
公共类查询响应
{
公共int Pos{get;set;}
public int Start{get;set;}
公共整数TotalRecords{get;set;}
公共列表数据{get;set;}
}
这是我的客户执行:

var client = new RestClient() { BaseUrl = new Uri(BaseUrl), Timeout = Timeout };
var response = client.Execute<QueryResponse<RoomEntity>>(request);
var client=new RestClient(){BaseUrl=newuri(BaseUrl),Timeout=Timeout};
var response=client.Execute(请求);
我从restsharp得到这个错误:

无法将类型为“RestSharp.JsonArray”的对象强制转换为类型为“System.Collections.Generic.IDictionary`2[System.String,System.object]”


您可以按照所述为RestSharp启用Json.NET,然后从中使用
ObjectToArrayConverter
。只需附带说明:“不带任何属性名的Json”->它有属性名。您看到的是一个包含数组的json文档。