Reputation: 808
I've tried several different string formats and json serializer settings but can not come up with the right combination; my date always comes out as the default min date value.
I'm doing:
_flashMessage = JsonConvert.DeserializeObject<FlashMessage>(msoSite.FlashMessage, settings);
Where FlashMessage is:
public class FlashMessage
{
public string Device { get; set; }
DateTime Expires { get; set; }
public List<string> Message { get; set; }
}
And my Json string is:
{
"Device": "Mobile",
"Expires": "2015-03-13T11:35:35",
"Message": [
"This is a test message..."
]
}
The date result I'm getting is:
Upvotes: 0
Views: 42
Reputation: 808
The answer is: my DateTime Expires property wasn't defined as public, therefore out of scope and not getting set.
Upvotes: 1