I'm trying to get Top 5 most profitable coins for mining from WhatToMine using their JSON in my pet C# project.
The problem is that instead of an array this site returns just single object (I've sorted the list of properties for brevity):
{
"coins":
{
"Hush":
{
"id":168,
"tag":"HUSH",
"algorithm":"Equihash",
},
"Zclassic":
{
"id":167,
"tag":"ZCL",
"algorithm":"Equihash"
}
}
I don't really need coin name, as tag is sufficient, so I would like to have something like this:
[
{
"id":168,
"tag":"HUSH",
"algorithm":"Equihash",
},
{
"id":167,
"tag":"ZCL",
"algorithm":"Equihash"
}
]
I tried to use JSON2CSharp, but it generated a bunch of classes with the same properties one per each coin. And because new ones are constantly added I don't want to change my code every time.
Surely I can do some search/replace or regex to make the JSON response string look like I need, but I guess true developers (which I'm not part of) know a better and more elegant way of deserializing a single object into list/array.