Convert list into json in C#

Introduction:

This article explains how to convert list into json in c# with example
 
Example: 

//Your List 
var Result=(List<TreeViewStructure>)Helper.ExecuteService("your context","GetDATA",null); 
JavaScriptSerializer jss = new JavaScriptSerializer();

string output = jss.Serialize(Result);  // It Return Json Data

-----------------OR-------------------------

var output= new JsonResult { Data = topItems1, ContentType = "Json"
JsonRequestBehavior = JsonRequestBehavior.AllowGet };
Ashwani
Ashwani

This is a short biography of the post author. Maecenas nec odio et ante tincidunt tempus donec vitae sapien ut libero venenatis faucibus nullam quis ante maecenas nec odio et ante tincidunt tempus donec.

No comments:

Post a Comment