Is it possible to return json by default from the ASP.NET Web API instead of XML?
It's what is done by default. If what you want is to only support
|
|||||
|
@tugberk's solution doesn't really accomplish the goal of changing the default formatter. It simply makes JSON the only option. If you want to make JSON the default and still support all of the other types, you can do the following:
Note: JSON is the default formatter as of Web API 2.0. |
||||
|
Accept : application/json
in the headers of your ajax request, WebAPI will respond in Json. Can I see your ajax request? – gideon Dec 1 '12 at 17:11