Sunday, 20 September 2015

How to convert .NET object to JSON string in MVC 5 .

Step 1: First create an empty MVC application
Step 2:Create Employee class in Model folder                                                                                         

Step 3: To converts List<Employee> objects to a JSON string we will use Serialize() method of         JavaScriptSerializer class.  
For that First Create a Empty Home Controller and Paste the Below code.

Step 4 : Create the Index view and write the below code                                                                        

    Layout = null;


Step 5 :Run the application
Done :)

1 comment: