Sunday, March 11, 2012

Is it possible to convert generic list into JSON format?

Hi,

take a look at this article:Tip/Trick: Building a ToJSON() Extension Method using .NET 3.5.

Grz, Kris.


You can use the built-in JavaScriptSerializer to do it.

Example:

using System.Web.Script.Serialization;...........................................JavaScriptSerializer s =new JavaScriptSerializer();List<string> yourList =new List<string>();string json = s.Serialize(yourList);

No comments:

Post a Comment