当前位置:编程学习 > JS >>

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


[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); 

补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,