I’m receiving a JSON date in the following format:
"launch_date": 1250553600
How should I modify the following to include a custom DateTime parser that allows me to convert that number into a DateTime object?
JsonConvert.DeserializeObject<NTask>(json);
public sealed class NTask
{
public DateTime launch_date { get; set; }
}
Alternatively I could use long and then parse it in another field but I’d rather avoid doing that, and have JsonConvert automatically parse it to DateTime through some converter.
You’re going to want to use a JSONConverter to help manage the translation. See this stackapps answer for more detail.