I want to get Json Data from WebApi when i call apiController it can return Xml data.
here is ShowDataController = ApiController
Sp_GetAllData() = Storeprocedure which contains simple select query
public class ShowDataController : ApiController
{
public IEnumerable Get()
{
AngulerEntities db = new AngulerEntities();
List res = db.Sp_GetAllData().ToList();
return res;
} }
when i run this http://localhost:10127/api/ShowData it will return xml data
if i use string type of method in ApiController and which is using JavaScriptSerializer().Serialize()
string output = new JavaScriptSerializer().Serialize(res);
return output;
it will return xml in json data.now i want to get Only json data while calling apiController.

Nilesh JadavPosted Oct 2, 2015, 5:28 AM
Open WebApiConfig.cs file in solution and add mentioned line in it as shown in example.
Nilesh JadavPosted Oct 3, 2015, 8:00 AM
Omprakash AmarwalPosted Oct 3, 2015, 7:55 AM