开发者

How do I consume JSON from a web service in ASP.NET?

We have a web application providing a service using a simple REST interface (GET/POST methods) and returning resu开发者_开发百科lts in JSON format.

A client wants to use the service from an ASP application (I assume ASP.NET) and asks for example code.

Is there any standard/widely-acceptable procedure for consuming JSON based web services from an ASP.NET application? I'm not familiar with the .NET framework, but can work my way through C#.

Any pointers are welcome.


There's quite a few JSON libraries available for .NET that will convert JSON to POCO objects:

Json.NET by Jason King
JsonFx.NET

The json.org website has references to these libraries and more.

There's even support for Classic ASP (which is not the same as ASP.NET):

JSON2.ASP


You can try using a library that already exists:

http://www.nateirwin.net/2008/11/20/json-array-to-c-using-jsonnet/

or you can build your own, something like this:

http://geekswithblogs.net/Mochalogic/articles/103330.aspx

JSON is fairly easy to work with though, so you should not have any issues.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜