Author: DanyZift | Posted on: 4/13/2009 11:47:28 AM | Views : 442

Hi,

How do i change the return content type to json from a web service?

I put the following in the Web Service class:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetInfo(int someNum){
Then using the JavaScriptSerializer it changes the List<> to: [{"Content1":"First Content"},{"Content2":"Second Content"}] - but the Content Type is still xml like below?  <?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">[{"Content1":"First Content"},{"Content2":"Second Content"}]</ Go to the complete details ...