I use the WCF RESTful web service and I get this error:
An error occurred while trying to deserialize the parameter http://tempuri.org/:aa . The InnerException message was "There was an error deserializing an 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. '. See InnerException for more details. '. See Server Logs for more details. Trace exception stack: `
in the System.ServiceModel.Dispatcher.DataContractJsonSerializerOperationFormatter.DeserializeParameterPart (XmlDictionaryReader reader, Part PartInfo) in the System.ServiceModel.Dispatcher.DataContractJsonSerializerOperationFormatter.DeserializeParameter.DerminalDermoderatorDermoderatorDermoderatorDermodelter ] parts, Object [], PartInfo returnInfo, Object & returnValue) in System.ServiceModel.Dispatcher.DataContractJsonSerializerOperationFormatter.DeserializeBodyCore (XmlDictionaryReader reader, Object [], Boolean isRequest) in
Login 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);
Testing Class:
public class Test
{
[JsonProperty(ItemConverterType=typeof(IsoDateTimeConverter))]
public DateTime xaaaaaa { get; set; }
}
xaaaaaa : /Date(new Date.valueOf().toString())/, . WCF IsoDateFormat .
, . JSON.NET, , ISO. - WCF?