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<Sp_GetAllData_Result> Get()
{
AngulerEntities db = new AngulerEntities();
List<Sp_GetAllData_Result> 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.