Author: rippetoe | Posted on: 9/29/2008 12:31:30 PM | Views : 567

Hello,

I have created a simple web service and method that returns 'Hello World', but I want the method to return the string as json. I have set ResponseFormat = ResponseFormat.Json and on the client I have set the request content type to "application/json; charset=utf-8". Still, the response is always xml. Any thoughts about what i need to change to get a json response. I am using Prototype.js to handle all the ajax stuff. I have verified that the request object does have the correct content type and that the response object does have null for responseJSON and null for headerJSON.

aspnet 3.5, windows server 2008, IIS 7, vb.net

Thank you.

(relevant code)

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Go to the complete details ...