I wanted to post an alternative solution where you can serialize the 0 index and any other indexes that follow it to achieve something like this.

The trick is to use a Dictionary. If you expect that the ID number will always be an integer, then you can construct the first part of the dictionary like this to start with.
Dictionary<int, ...>
And if it's a string, just change the int to a string.
If VK, OK and WA are the only 3 elements you expect, you can use the AllObjects class from Jawads answer like this.
// Dictionary<int, AllObjects>>
JsonConvert.DeserializeObject<Dictionary<int, AllObjects>>(json);
I would also modify Jawads AllObjects class to make sure the property names comply with C# conventions by using the JsonProperty attributes to our advantage like this.
public class AllObjects
{
[JsonProperty("vk")]
public CostCountResponse Vk { get; set; }
[JsonProperty("ok")]
public CostCountResponse Ok { get; set; }
[JsonProperty("wa")]
public CostCountResponse Wa { get; set; }
}
The output of deserializing will give us this result.

If however you are expecting more elements than just VK, OK and WA, you can cover this case with another nested dictionary like this.
Dictionary<int, Dictionary<string, ...>>
This string in the nest Dictionary is what will contain vk, ok, etc..
So what we have now is a Dictionary within a Dictionary which accurately represents how the JSON data is nested so far.
The final part is deserializing the JSON element containing the Cost and Count properties, and we can use the class Jawad posted to do that (I'm showing one that's again slightly modified to keep with naming conventions)
public class ObjInfo
{
[JsonProperty("cost")]
public int Cost { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
}
We can now use the ObjInfo class as the final puzzle of the Dictionary we've been defining.
Dictionary<int, Dictionary<string, ObjInfo>>
Which we can use like this (I've included the modified JSON I've been using as well to demonstrate what we can do here)
static void Main()
{
var root = JsonConvert.DeserializeObject<Dictionary<int, Dictionary<string, ObjInfo>>>(testJson);
foreach (var item in root)
{
Console.WriteLine($"Id: {item.Key}");
foreach (var subitem in item.Value)
{
Console.WriteLine($" SubCode: {subitem.Key}");
Console.WriteLine($" Cost: {subitem.Value.Cost}");
Console.WriteLine($" Count: {subitem.Value.Count}\n");
}
}
// Or access individual items by
var zeroVk = root[0]["vk"];
// Console.WriteLine(zeroVk.Cost);
// Console.WriteLine(zeroVk.Count);
}
public class ObjInfo
{
[JsonProperty("cost")]
public int Cost { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
}
const string testJson = @"{
""0"": {
""vk"": {
""cost"": 19,
""count"": 1903
},
""ok"": {
""cost"": 4,
""count"": 2863
},
""wa"": {
""cost"": 4,
""count"": 2210
}
},
""1"": {
""vk"": {
""cost"": 11,
""count"": 942
},
""ok"": {
""cost"": 68,
""count"": 1153
},
""wa"": {
""cost"": 14,
""count"": 7643
}
}
}";
This will spit out a response like this.
Id: 0
SubCode: vk
Cost: 19
Count: 1903
SubCode: ok
Cost: 4
Count: 2863
SubCode: wa
Cost: 4
Count: 2210
Id: 1
SubCode: vk
Cost: 11
Count: 942
SubCode: ok
Cost: 68
Count: 1153
SubCode: wa
Cost: 14
Count: 7643

Dictionary<string, Dictionary<string, Product>>would be easiest. See dotnetfiddle.net/dx2PVE which was going to be in answer to Handling JSON into readable data by Connor Raven but which got deleted.