I’m currently experimenting with using WCF Data Services as a way to open up our product a bit more while at the same time being able to consume the data from AJAX. One thing that I noticed is that the JSON represention format has these __metada members sprinkled across the data, and in the OData documentation I found this (under Representing Entries):
An optional “__metadata” name/value
pair is the only pair that should be
included on the object that does not
directly represent a Property of the
Entry being represented. This
name/value pair is not data, but
instead, by convention defined in this
document, specifies the metadata for
the Entry being represented.
My question is, if this metadata is optional, how do I turn it off to save bandwidth?
You are right that the WCF Data Services server implementation does not have the ability to not send the __metadata. The fact that the protocol makes it optional doesn’t mean that a specific implementation won’t send it always. In this case the server generates the __metadata because it may contain vital information for the client and without the the payload might not make sense or provide incomplete information.
Currently the server also doesn’t provide any option to change this behavior.