C# JavaScriptSerializer反序列化返回0结果列表

C# JavaScriptSerializer反序列化返回0结果列表,c#,json,javascriptserializer,C#,Json,Javascriptserializer,正在尝试将json字符串反序列化为列表。Json字符串不是空的。但反序列化后,列表返回0项 这是我的课 [Serializable] public class Products : GenericItem { public List<string> Images { get; set; } public double Price { get; set; } public double SalePrice { get;

正在尝试将json字符串反序列化为列表。Json字符串不是空的。但反序列化后,列表返回0项

这是我的课

 [Serializable]
    public class Products : GenericItem
    {
        public List<string> Images { get; set; }
        public double Price { get; set; }
        public double SalePrice { get; set; }

        public bool OnSale
        {
            get { return (SalePrice < Price); }
        }

        public string Description { get; set; }

        public GenericItem Brand { get; set; }

        public List<GenericItem> Shops { get; set; }

        public string ProductCode { get; set; }

        public Colour Colour { get; set; }
    }

    [Serializable]
    public class Colour : GenericItem
    {
        public string Code { get; set; }
    }

    [Serializable]
    public class GenericItem
    {
        public string Name { get; set; }

        public string Permalink { get; set; }
    }
这就是我反序列化json字符串的方式

"{\"Products\":[{\"_id\":\"515c151f7be95925d4ee794d\",\"Name\":\"CAT Formation Steel Toe - Boots  BLACK\",\"Description\":\"CAT Formation Steel Toe Boots With heavy-duty hardwearing uppers, high grip rubber outsoles and a steel toe cap, these CAT Formation Steel Toe Boots are perfect for work. CAT Formation Steel Toe Boots are ankle length and fasten with strong laces for a secure fit. The boots are available in black and have a casual multi-panelled trainer-style appearance, as well as CAT branding on the tongue and heel.\",\"ProductCode\":\"D0073\",\"Images\":[\"18000.jpg\",\"18001.jpg\",\"18002.jpg\"],\"Brand\":{\"_id\":\"5142ca0c7be95917acce7755\",\"Name\":\"CAT\",\"Permalink\":\"cat-footwear\"},\"Shops\":[{\"_id\":\"5142ca237be95917acce7999\",\"Name\":\"Mens\",\"Styles\":null,\"Permalink\":\"Mens\"}],\"Permalink\":\"cat-formation-steel-toe-boots-black\",\"Price\":89.99,\"SalePrice\":89.99}]}"
 var jss = new JavaScriptSerializer();
            jss.MaxJsonLength = Int32.MaxValue;
            var results = jss.Deserialize<List<Products>>(json);
var jss=new JavaScriptSerializer();
jss.MaxJsonLength=Int32.MaxValue;
var results=jss.Deserialize(json);
列表始终返回0个结果


谁能帮帮我吗。

你的JSON不是一个列表,而是一个具有属性Products的对象,即列表

您可以将其反序列化为以下内容:

public class MyClass
{
    public List<Products> Products { get; set; }
}
...

jss.Deserialize<MyClass>(json);
公共类MyClass
{
公共列表产品{get;set;}
}
...
反序列化(json);

谢谢您的回复。我看不出我的错误。