I am working on a Windows 8 app wherein I need to deserialize a JSON feed that contains variables which begin with an ‘@’ sign.
I’ve defined classes that have members with the same names as the variables in the JSON, then call DataContractJsonSerializer to deserialize the JSON into C# classes. This all works fine and dandy except for the variable names that begin with ‘@’.
Like this:
public class HotelDetails
{
public string hotelId;
public string name;
public string address1;
...
}
The JSON looks like this:
{"@order":"0",
"hotelId":268026,
"name":"Monte Cristo",
"address1":"600 Presidio Avenue",
...
Since I can’t define a C# variable that begins with ‘@’ how do I deserialize the “@order” variable?
Try this?
Don’t know if that works though… haven’t tested it.