Below json and C# class does not match because there are two json objects named same "Event". I am getting null from the second "Event" object. I could not find the matched C# class. What am I doing wrong?
This is json
{
"Sequence": 1802487,
"BusinessDate": "2020-05-17T00:00:00.0000000",
"Event": {
"Event": {
"@RegId": "2269"
}
}
}
and this is the C# classes that I am using for deserializing
public class Root
{
public long Sequence { get; set; }
public DateTime BusinessDate { get; set; }
[JsonProperty("Event")]
public Event1 Event { get; set; }
}
[JsonObject("Event")]
public class Event1
{
public Event Event { get; set; }
}
public class Event
{
[JsonProperty("@RegId")]
public string RegId { get; set; }
}
What I have tried:
Because of there are two "Event" json objects, I had to change the one of the class names as "Event1". But I am getting null for RegId