I'm having troubles to desirialize a JSON string to n object using JSON.net
I've tried the following but results are always null :
class auctionList
{
public auctionInfo auctionInfo { get; set; }
}
class auctionInfo
{
public IList<auction> auctions { get; set; }
}
class auction
{
public string tradeId { get; set; }
}
Here is the json string :
{
"auctionInfo": [
{
"tradeId": 276649263881
},
{
"tradeId": 356444585498
},
.......
]
}
auctionList auctions = JsonConvert.DeserializeObject<auctionList>(json);
auctions
is always null.
and is DeserializeObject the fastest way to do it if I just wanna reach 'tradeId' ?
Any ideas ? Thanks.
auctioninfois an object in your class whereas in your json it is an array.auctionList, populated with your data (shown above) and serialize it to json. Compare it to your incoming data.