I have a JSON file with the structure:
[ {"unit_id": {"type":[string],"customer_id":[int]} }, ..., ...] And I want to convert it to a dictionary (or anything useful) of the structure:
Dictionary<int,Tuple<string,int>> I am trying the following:
Dictionary<int, Tuple<string,int>> units = JsonConvert.DeserializeObject<Dictionary<int, Tuple<string, int>>> (File.ReadAllText(jsonFile)); Which fails because the file can't be deserialized into that structure. I have also tried creating a class:
class Unit{ public int unitID; public Tuple<string, int> details; } And then:
List<Unit> units = JsonConvert.DeserializeObject<List<Unit>>(File.ReadAllText(jsonFile)); Which doesn't fail, but doesn't fill the list with any values.
Thanks