I have a json structured like that:
{
"eventType1": {
"unitName": "nameValue",
"comment": "initial comment"
},
"eventType2": {
"comment": "initial message"
},
}
When I deserialize it the appropriate type seems to be something like Dictionary<string, <Dictionary<string,string>>>
and method would look like that:
public static Dictionary<string, Dictionary<string, string>> defaultFieldDataByEvent =
JsonConvert
.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(defaultFieldDataByEventSerialized);
which looks, well, ugly. But that's exactly how I need it to extract the data - defaultFieldDataByEvent[eventType][field]
.
Can I encapsulate the type into something somehow or is there a different approach to such cases?