Click here to Skip to main content
15,792,870 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:

In the REST services I have created my [DataContract] looks like this :
public class Emp
public Guid Eid {get;set;}
public string Ename{get;set;}
public DateTime CreatedDate{get;set;}


I am retrieving the results from database(SQL) and I am retrieving "Ename" value based on Eid.I wrote SQL query and its working fine.I am returing a list .Now I want to display it as JSON response .However I can view the XML response clearly like this :
When I decorate my OperationContract like this 
        [WebInvoke(UriTemplate = "GetEName/?id={eid}", Method= "GET",ResponseFormat=WebMessageFormat.Json)]
        Emp GetName(Guid eid); 

and run the application then I am getting error:"[Fiddler] ReadResponse() failed: The server did not return a response for this request."

I guess this is only because browser is not taking default date to be 0001-01-01T00:00:00 in JSON response

How can I make this corrected and get the response when the returned date is 0001-01-01T00:00:00?What are the modifications I have to do in the code(DataContract) ?

Thanks in advance...

1 solution

refer this link

if date is null then just replace it with blank space

WCF REST Service with JSON[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900