I am using WCF RESTful webservice and I am getting this error:
There was an error while trying to deserialize parameter http://tempuri.org/:aa. The InnerException message was 'There was an error deserializing the object of type WcfService1.Test. DateTime content '2014-05-31T18:30:00.000Z' does not start with '/Date(' and end with ')/' as required for JSON.'. Please see InnerException for more details.'. See server logs for more details. The exception stack trace is:`
at System.ServiceModel.Dispatcher.DataContractJsonSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part) at System.ServiceModel.Dispatcher.DataContractJsonSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part) at System.ServiceModel.Dispatcher.DataContractJsonSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, PartInfo returnInfo, Object& returnValue) at System.ServiceModel.Dispatcher.DataContractJsonSerializerOperationFormatter.DeserializeBodyCore(XmlDictionaryReader reader, Object[] parameters, Boolean isRequest) at
Input from jQuery:
$.ajax({ url: "Restful.svc/new/one", type: "POST", contentType: "application/json; charset=utf-8", headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, data: JSON.stringify({ aa: { xaaaaaa: "2014-05-31T18:30:00.000Z" } }), dataType: 'json', processData: true, success: function (msg) { alert(msg.helloWorldResult); }, error: function (msg) { var y = 0; } }); WCF Service:
[OperationContract] [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "new/one")] String helloWorld(Test aa); Test class:
public class Test { [JsonProperty(ItemConverterType=typeof(IsoDateTimeConverter))] public DateTime xaaaaaa { get; set; } } If I pass the input xaaaaaa as : /Date(new Date.valueOf().toString())/ it takes in. How do I change the default date formatter in the WCF Service to use IsoDateFormat for serialize and deserializing.
I have tried modifying the route table settings but I was not able to find most of the libraries. If I use JSON.NET it says it uses ISO format by default. How do I set it to take it in the WCF web service?

"\"0001-01-01T00:00:00"\", when received on client side ). Thank you @Irb it works now.