Thursday, 15 January 2015

c# - WCF RESTful passing JSON Datetime always null -



c# - WCF RESTful passing JSON Datetime always null -

i utilize .net wcf + restful developing service , wiztools.org restclient tesing. have problem receiving json datetime client. datetime.minvalue.

here datacontract

[datacontract(name = "origin")] public class originobject { [datamember(name = "airport")] public string airport { get; set; } [datamember(name = "oddt")] public datetime oddt { get; set; } [datamember(name = "eddt")] public datetime eddt { get; set; } } [datacontract(name = "destination")] public class destinationobject { [datamember(name = "airport")] public string airport { get; set; } [datamember(name = "odat")] public datetime odat { get; set; } [datamember(name = "edat")] public datetime edat { get; set; } }

and here testing json (please ignore "acid", "destination" , "origin")

{ "acid" : "aaa1", "destination" : { "airport" : "vvvv", "eddt" : "2013-03-05t20:20:31.000z", "oddt" : "/date(1362489941)/" }, "flightplanstate" : "active", "origin" : { "airport" : "xxxx", "edat" : "\/date(1362499081)\/", "odat" : "1362498721" } }

all of 4 datetime styles above min-value in code-behind (just datetime, both "airport" fields have normal values).

datetime not defined json, though "eddt" value looks value ought parsable mutual .net json serializer.

my suggestion utilize string properties, , add together getoddt() etc. functions parse string values datetime values; if required, add together setoddt() etc. functions, , not forget update corresponding string values!

c# json wcf rest datetime

No comments:

Post a Comment