I'm trying to deserialize json into a class, but "Не удается преобразовать объект типа "System.Boolean" в тип "Sell_Offers"" error "Не удается преобразовать объект типа "System.Boolean" в тип "Sell_Offers"" I want to access offers
var rez = new JavaScriptSerializer().Deserialize<Root>(json)); -
{ "success": true, "results": [ { "classid": "1812818783", "instanceid": "188530139", "sell_offers": { "best_offer": 324, "offers": [ [ 324, 1 ], [ 444, 2 ], [ 446, 1 ], [ 524, 1 ], [ 528, 2 ], [ 540, 1 ], [ 543, 1 ], [ 554, 1 ], [ 1498, 2 ], [ 1500, 1 ] ], "my_offers": null }, "buy_offers": null, "history": null, "info": { "our_market_instanceid": null, "market_name": "P250 | Iron Clad (Немного поношенное)", "name": "P250 | Iron Clad", "market_hash_name": "P250 | Iron Clad (Minimal Wear)", "rarity": "Армейское качество", "quality": "Немного поношенное", "type": "Пистолет", "mtype": "CSGO_Type_Pistol", "slot": "Обыч." } } ] }
The built-in generator in Visual Studio gave the following class code
public class Root { public bool success { get; set; } public Result[] results { get; set; } } public class Result { public string classid { get; set; } public string instanceid { get; set; } public object sell_offers { get; set; } public object buy_offers { get; set; } public object history { get; set; } public Info info { get; set; } } public class Info { public object our_market_instanceid { get; set; } public string market_name { get; set; } public string name { get; set; } public string market_hash_name { get; set; } public string rarity { get; set; } public string quality { get; set; } public string type { get; set; } public string mtype { get; set; } public string slot { get; set; } }