I have .NET web service which supposed to return the result as JSON, but it returns it as XML? Here is my code.
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<MyData> GetMyData(string dataFilter, string param)
{
if (dataFilter.ToLower() == "filterValue")
return getData(param);
return null;
}
And here is
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<customErrors mode="Off"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>