Here's sample JSON:
{
"notifications": [
{
"Profile.Guestbook.Post": {
"TargetIntId": 1,
"Digest": true,
"DigestSchedule": "00 * * * * *"
},
"Profile.MediaEntry.Post": {
"TargetIntId": 1,
"Digest": true,
"DigestSchedule": "00 * * * * *"
}
}
]
}
I'm trying to serialize into C# classes, where the NotificationInfo
instance's EventName
is the value of the keys, event.namespace1
and event2.namespaceX
public class Preferences
{
public List<NotificationInfo> Notifications { get;set; }
}
public class NotificationInfo
{
public string EventName { get;set; }
public int TargetIntId { get;set; }
public bool Digest { get;set; }
}
I created a dotnetfiddle: https://dotnetfiddle.net/8oqniT