With the JSON defined as it is, in order to deserialize it as an object, I\'d need to create a property on my class called \"event\", which is a C# keyword. Is there anothe
Try using the [DataContract(Name = "@event")]
attribute on the relevant property. Then it will (de)serialize correctly, and you can rename the property so that it compiles.
Change
public class Event
{
public int event { get; set; }
public EventDetail data { get; set; }
}
to this
public class Event
{
public int @event { get; set; }
public EventDetail data { get; set; }
}
This tip shows the quirks involved with escaping in C#:
e.g. '\'', '\n', '\u20AC' (the Euro € currency sign), '\x9'
(equivalent to \t)) - literal string escaping:
e.g. "...\t...\u0040...\U000000041...\x9..."
e.g. @"...""..."
e.g. "...{{...}}..."
e.g. @if (for if as identifier)
e.g. i\u0064 (for id)
I was able to just capitalize the "e", and it still works. Looks like the parsing mechanism is case-insensitive.