I'm trying to deserialize this piece of JSON into C# (The outer string increases to the hundreds):
{
"1": {
"name": "AK-47 | Aquamarine Revenge (Battle-Scarred)",
"price": 12.64,
"sold": 381
},
"2": {
"name": "AK-47 | Aquamarine Revenge (Factory New)",
"price": 35.55,
"sold": 190
}
}
The problem here is that this JSON is structured a bit different than what I'm used to, as the Root here seems like a List.
I've tried to create classes I thought would be correct (I do not know what the name of the list should be):
public class BpRoot
{
public List<BpInfo> items { get; set; }
}
public class BpInfo
{
public string name { get; set; }
public string price { get; set; }
public string sold { get; set; }
}
But after deserializing the JSON with the JsonConvert.DeserializeObject()
method, and trying to print them out in the console, it simply returns null.
So how would I structure the classes if the root object is a list?
Any help is appreciated.