2
votes

I want my OData service to support Json serialization, I read about a WCF Data Service toolkit which add this behaviour to the V2 version. After I read WCF Data Service released a new version of WCF Data Service 5.0, I need to know how to do it.

I add the $Format=json and I get all the time this attribute isn't supported.

Any suggestion . Thanks in advance ...

1

1 Answers

4
votes

The usual way to request JSON is to use Accept header (basically following HTTP, if the client wants a certain representation of the response, it should ask for it in the Accept header). So if you send Accept: application/json;odata=verbose, you will get the Verbose JSON response.

WCF Data Services currently doesn't implement the $format query option. But you can add it "on top". There are several ways to do this (just search the web). One of them is for example here: http://archive.msdn.microsoft.com/DataServicesJSONP