I have the following DateTime field in business entity c# :
public DateTime BirthDate { get; set; }
I got the following message when I call the API passing the entity object as JSON:
DateTime content '2009-02-15T00:00:00Z' does not start with '\/Date(' and end with ')\/' as required for JSON.
I searched the web tried many formats but does not work with me!
The error message is clear! but I have more than an hour trying to send a request to my API. Please do not vote down my post! I did my best.
This is the JSON object I sent via postman:
{
"patient": {
"Number": 20012,
"FirstName": "ِAnas",
"LastName": "Tina",
"BirthDate":"1986-12-29",
"Phone": "000000",
"Mobile": "00000",
"Address": "Damas",
"Job": "Developer",
"Note": "This is a note",
"GenderId": 1
}
}
[DataContract]
public class Patient
{
[Description("Patient's Id in ECMS database")]
[DataMember(Order = 1)]
public int Id { get; set; }
[Description("Patient's unique number")]
[DataMember(Order = 2)]
public int Number { get; set; }
[Description("Patient's first name")]
[DataMember(Order = 3)]
public string FirstName { get; set; }
[Description("Patient's last name")]
[DataMember(Order = 4)]
public string LastName { get; set; }
[Description("Patient's birth date")]
[DataMember(Order = 5)]
public DateTime BirthDate { get; set; }
}