useing asp.net webservice with method :
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<MyObject> GetList()
{
....return new List of MyObject{ x = .., y = .. , z = ..};
}
the client using that service is with JQuery Ajax call is working good
$.ajax({
type: "POST",
url: url,
data: data == null ? "{}" : data,
contentType: "application/json; charset=utf-8",
dataType: "json",
..... and so on ...
but with firebug I’ve notice that the response is :
{"d":[{"__type":"Common.MyObject","z":"2000","x":1500,"y":1000,"a":"0"},{"__type":"Common.MyObject","z":"2000","x":1455,"y":1199.57,"a":"1"}
...... and so on
]}
1) question is why do I need this “”__type”:”Common.MyObject” ?
2) I want to remove it so the response will be smaller , how can I do it ?
ok ,I used httpmodule and regex to change the response
httpmodule by:
http://bloggingabout.net/blogs/adelkhalil/archive/2009/08/14/cross-domain-jsonp-with-jquery-call-step-by-step-guide.aspx#525423
regex by :
https://stackoverflow.com/a/6349813/1218546
and it works for all services methods