use*_*230 5 c# json web-services
我是第一次做网络服务.我需要在c#中使用json.我没有得到如何编码从数据库获取数据的方法任何suggessions.
Pey*_*man 13
您可以使用以下代码返回JSON序列化字符串:
[WebMethod(Description = "Your Description")]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string FunctionName()
{
// Return JSON data
JavaScriptSerializer js = new JavaScriptSerializer();
string retJSON = js.Serialize(Object);
return retJSON;
}
Run Code Online (Sandbox Code Playgroud)