欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Asp.net中将对象转化为JSON格式的字符串

程序员文章站 2022-05-21 08:13:57
[csharp] ///   /// Converts an object to its JSON representation.&...

[csharp]
/// <summary> 
/// Converts an object to its JSON representation. 
/// </summary> 
/// <param name="obj"></param> 
/// <returns></returns> 
public static string ConvertToJson(object obj) 

    return new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(obj);