c# - HTTP WCF Service, JSON date formatting issue returning IEnumerable<class> -


i have restful wcf http service returns json , works great, except datetime doesn't format correctly:

e.g. "adjuddate": "/date(1349409600000-0400)/"

after looking around found old post here not code work. last updated in 2011. there maybe more current version or implementation? json.net serializer wcf rest services

here's code returns ienumerable.

//all json values except dates:

private ienumerable<customer> processwcfpost(customer searchmodel) {     return _repository.getcustomers(searchmodel); } 

edit i've of course tried changing return type string instead of ienumerable as:

private string processwcfpost(customer searchmodel)     {         var result = _repository.getcustomers(searchmodel);         return newtonsoft.json.jsonconvert.serializeobject(result);     } 

but json not quite right: [{\"claimprocessid\":1599986,\"clmhdrid\":1011,\"clmlineid\":1011,\"clmadjid\":1011,\"receiveddtsur\":\"2012-12-05t00:00:00\",\"adjudicationdtsur\":\"2011-10-05t00:00:00\"(on , on)...

i facing same problem , find solution might anybody. solution based on datetimekind.utc return date without -0400, ex:

public function test() date  dim dateformatted new datetime(2017, 07, 04, 8, 18, 42, datetimekind.utc) return dateformatted   end function 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -