We can also decorate the JsonConverter attribute with datetime format as param on an as-needed basis:
class MyDateTimeConverter : IsoDateTimeConverter
{
public MyDateTimeConverter(string format)
{
DateTimeFormat = format;
}
}
And use on class property:
[JsonConverter(typeof(MyDateTimeConverter), "yyyy-MM-ddThh:mm:ss tt")]
public DateTime timestamp { get; set; }
Posted On:
13-Nov-2019 08:01