Tech
Forums
Jobs
Books
Events
Conference
Annual Conference
Bcrypt
Live
Learn
More
Training
Interviews
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
How to get Json format data in WebApi
Omprakash Amarwal
Oct 2 2015 4:34 AM
509
Reply
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
How to print multi datagridview in a single page in c#
How To ExcecuteCommandSyncronisation in ASPNET