I need to define in a json file bands containing a dynamic value ranges configuration. They might change in future, so I would like it to look like this:
"Bands": {
"5-15": [ 5000, 15000 ],
"15-30": [ 15000, 30000 ],
"30-45": [ 30000, 45000 ],
"45-60": [ 45000, 60000 ],
"60-100": [ 60000, 100000 ]
}
Is it possible to read with this json format and store it in an object?
I tried this:
public class BandsMapping
{
public List<Bands> Bands { get; set; }
}
public class Bands
{
public string Name { get; set; }
public List<int> ValueRanges { get; set; }
}
But it fails because there's no Name neither ValueRanges in the json file. But I would like the json file to look something like this.
Any idea on how can I achieve that?
Bandsinto aDictionary<string, int[]>and then convert it to the mapping you want.