我想使用Asp.net返回JSON webservice c# [英] I Want to return JSON webservice using Asp.net c#

查看:75
本文介绍了我想使用Asp.net返回JSON webservice c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用C#在Asp.net中返回Json Webservice。这是我想要的Webservice返回。



{Cargo:[{status:pickup,datetime:},{status :InTransit,



datetime:},{status:ReachedBLR,datetime:},{status :



StartedDEL,datetime:},{status:InTransit,datetime:},{status :ReachedDEL,datetime:}}} ..



请通过提供代码帮助我

先谢谢。 。

I Want to return Json Webservice in Asp.net Using C# . This is return Webservice i Want.

{ "Cargo": [ { "status": "pickup", "datetime": "" }, { "status": "InTransit",

"datetime": "" }, { "status": "ReachedBLR", "datetime": "" }, { "status":

"StartedDEL", "datetime": "" }, { "status": "InTransit", "datetime": "" }, { "status": "ReachedDEL", "datetime": "" }] }..

Please help me by giving code
Thanks In advance..

推荐答案

检查此链接。



http://stackoverflow.com/questions/2086666/how-do-i-return-clean-json-from-a-wcf-service [ ^ ]



http://www.mikesknowledgebase.com/pages/Services /WebServices-Page1.htm [ ^ ]
Check this links.

http://stackoverflow.com/questions/2086666/how-do-i-return-clean-json-from-a-wcf-service[^]

http://www.mikesknowledgebase.com/pages/Services/WebServices-Page1.htm[^]


更多链接 -

带有jQuery的JSON ASP.NET Web服务 [ ^ ]

如何在ASP.NET中创建JSON Web服务 [ ^ ]

从.Net 4.0网络服务中返回JSON [ ^ ]
Some more links -
JSON ASP.NET Web Services with jQuery[^]
How To Create A JSON Web Service In ASP.NET[^]
Returning JSON from a .Net 4.0 web service[^]


JSON只不过是通过字符串传递的数据交换格式...

因此,如果您有在服务器中创建JSON的方法,那么您拥有的所有内容要做的是将它变成一个字符串(stringify)并将其作为方法中的字符串返回...

JSON is nothing more than a data exchange format delivered over string...
So if you have the method that creates the JSON in the server, all what you have to do is turn it into a string (stringify) and return it as a string from your method...
[WebMethod]
public string GetCargoInfo()
{
  return("{\"Cargo\":[...]}");
}


这篇关于我想使用Asp.net返回JSON webservice c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆