开发者

How to convert an Object List into JSON in ASP.NET

I have a list of person objects which I want to send in response to a jquery' ajax request. I want to send t开发者_如何学JAVAhe list into JSON format. The list is as follows -

List<Person> PersonList = new List<Person>();

Person X = new Person("X", 23, "This is X");
Person Y = new Person("Y", 24, "This is Y");

PersonList.Add(X);
PersonList.Add(Y);

How can I convert this PersonList list into JSON ?


JSON.NET has worked really well for me. http://www.codeplex.com/Json

And if you are doing Web Forms and JQuery then this link might help you out:

http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜