Downloaded the WCF REST Template from this location.
The default response format is XML, which works great. However, when I try to get a JSON response, I still get XML.
This is my modified code -
[WebGet(UriTemplate = "",ResponseFormat = WebMessageFormat.Json)]
public List<SampleItem> GetCollection()
{
// TODO: Replace the current implementation to return a collection of SampleItem instances
return new List<SampleItem>() { new SampleItem() { Id = 1, StringValue = "Hello" } };
}
Note the ResponseFormat=WebMessageFormat.Json. That is the only change I did to that template.
What am I missing?
Thanks!