Hi, I want to know if by default the WCF web services return JSon data. and if no how can i configure the most simple WCF web service it to return Json.
thanks in advance.
Hi, I want to know if by default the WCF web services return JSon data. and if no how can i configure the most simple WCF web service it to return Json.
thanks in advance.
The easiest way I know is to create the WCF service in VS (I have VS 2008) with the "AJAX-enabled WCF service" template. It will give you boilerplate code for a JSON-enabled WCF service.
The objects that it takes as arguments and returns must be marked with the [DataContract] attribute, and each property that you want to include in the JSON serialization should be marked with [DataMember] and should have a getter and a setter (even if the setter does nothing).