I am talking to a web service from Xamarin. It is sending dates down over the wire in JSON, in ISO-8601 format, like this:
"2016-05-13T16:02:47.480-07:00"
If I try to deserialize just a single date, it works fine. But when the DateTime is a member of class, it does not work. No error is given. Here is some example code:
using ServiceStack.Text;
class TestDate {
public DateTime testDate;
}
void Test() {
JsConfig.DateHandler = JsonDateHandler.ISO8601;
// this works just fine:
String dateString = "2016-05-13T16:02:47.480-07:00";
DateTime theDate = dateString.FromJson<DateTime> ();
// this does not deserialize
String testStr = "{\"testDate\":\"2016-05-13T16:02:51.923-07:00\"}";
TestDate tester = testStr.FromJson<TestDate> ();
}
Any ideas? I don't see any error, just get a new TestDate object without the date being set.