RestSharp C#JsonDeserializer将给定对象属性值的列表设置为null

RestSharp C#JsonDeserializer将给定对象属性值的列表设置为null,c#,restsharp,C#,Restsharp,我的响应对象中有一个json结果集,如下所示 [{ "id": "13", "category_id": "[\"2\"]", "store_id": "[\"3\"]", "name": "Sp juise", "price": "1", "description": "<p><b><\/b><br><\/p>", "image": "<p>You did not select a file to upload.<

我的响应对象中有一个json结果集,如下所示

 [{
"id": "13",
"category_id": "[\"2\"]",
"store_id": "[\"3\"]",
"name": "Sp juise",
"price": "1",
"description": "<p><b><\/b><br><\/p>",
"image": "<p>You did not select a file to upload.<\/p>",
"active": "1"
}, {
"id": "12",
"category_id": "[\"2\"]",
"store_id": "[\"3\"]",
"name": "Sp juise",
"price": "1",
"description": "<p><b><\/b><br><\/p>",
"image": "<p>You did not select a file to upload.<\/p>",
"active": "1"
}, {
"id": "11",
"category_id": "[\"3\"]",
"store_id": "[\"2\"]",
"name": "Berger (Chicken)",
"price": "80",
"description": "<p>Chicken Berger<\/p>",
"image": "assets\/images\/product_image\/5b374e99c53ce.jpg",
"active": "1"
 }, {
"id": "10",
"category_id": "[\"2\"]",
"store_id": "[\"2\"]",
"name": "Juce",
"price": "2",
"description": "<p>mixed<\/p>",
"image": "<p>You did not select a file to upload.<\/p>",
"active": "1"
 }, {
"id": "9",
"category_id": "null",
"store_id": "null",
"name": "Orenge juse",
"price": "2.5",
"description": "",
"image": "assets\/images\/product_image\/5b374ece3d909.jpg",
"active": "1"

 }]
下面是从json获取产品列表的代码

       RestHTTPClient.BaseUrl = new Uri(ServerURL + "/products/fetchProductJson");
        var request2 = new RestRequest(Method.GET);

        var response2 = RestHTTPClient.Execute(request2);

        JsonDeserializer deserializer = new JsonDeserializer();
        var products = deserializer.Deserialize<List<Product>>(response2);



        var strok = response2.StatusCode.ToString();
        if (strok == "OK")
        {
            ProductsUI(products);
        }
        else
        {
            throw new NotImplementedException();
        }
reshttpclient.BaseUrl=newURI(ServerURL+“/products/fetchProductJson”);
var request2=新的重新请求(Method.GET);
var response2=RestHTTPClient.Execute(request2);
JsonDeserializer反序列化程序=新的JsonDeserializer();
var products=反序列化器。反序列化(response2);
var strok=response2.StatusCode.ToString();
如果(冲程=“正常”)
{
ProductsUI(产品);
}
其他的
{
抛出新的NotImplementedException();
}

产品具有可通过枚举的对象,但字段未映射到类属性,并且它们都为列表中的每个对象返回空值。

这是由于缺少get和set 下面的例子解决了这个问题

public class Product
    {
    public string id { get; set; }
    public string category_id { get; set; }
    public string store_id { get; set; }
    public string name { get; set; }
    public string price { get; set; }
    public string description { get; set; }
    public string image { get; set; }
    public string active { get; set; }

}
public class Product
    {
    public string id { get; set; }
    public string category_id { get; set; }
    public string store_id { get; set; }
    public string name { get; set; }
    public string price { get; set; }
    public string description { get; set; }
    public string image { get; set; }
    public string active { get; set; }

}