Home > MVC > ASP.NET CORE Return JSON from Controller



ASP.NET CORE Return JSON from Controller

In this article, we will explain how to return JSON from the controller in ASP.NET CORE with an example and a sample code.


In this article, we will explain how to return JSON from the controller in ASP.NET CORE with an example and a sample code. In this example, we are using the Jquery document load function. on the load we using Ajax Post Method to get data from the server-side.

 

Step -1

Open Visual Studio and select Create a new Project.

ASP.CORE  Return JSON from Controller

 

Step -2

Select new Application type.

ASP.CORE  Return JSON from Controller

 

Step -3

Enter your project name and Set project location.

ASP.CORE  Return JSON from Controller

 

Step -4

Select new Web Application type.

ASP.CORE  Return JSON from Controller

 

Index.cshtml

We are using map function to make HTML.

 

Stockmodel.cs

 

HomeController

 

Output

ASP.NET CORE  Return JSON from Controller

 

Download




Note: All contents are copyright of their authors.



Comments



Leave a Reply

Comment:*
Email ID:*


Name:*