.net - How to return custom datetime format in WCF REST Service? -


as know,we can define method called client in wcf rest service this:

[webinvoke(uritemplate = "validatelogin", method = "post", responseformat = webmessageformat.json)] public validationclass validatelogin(requestobject obj){...} 

the object validationclass contains datetime type property.

it return result below client.

{     "isvalid":true,     "returnmessage":"string",     "tokenid":"string",     "zones":[{         "dayofweek":"string",         "end_time":"\/date(928120800000+0800)\/",         "id":2147483647,         "phone_no":"string",         "start_time":"\/date(928120800000+0800)\/"     }],     "zonesopen":[{         "id":2147483647,         "position_end_time":"\/date(928120800000+0800)\/",         "position_start_time":"\/date(928120800000+0800)\/",         "position_week":2147483647,         "tt_id":"string"     }] } 

client(android developer) have convert datetime value standard time format 'yyyy-mm-dd hh:mm:ss', complain not friendly them.

so try resolve this, in opinion, there interface(or abstract class) serialize object json string, need inherit , override methods, add elements configuration file tell system use serialization class instead of itself, no way far.

does idea work?


Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -