1

We have a web application providing a service using a simple REST interface (GET/POST methods) and returning results 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.

Kev
  • 118,037
  • 53
  • 300
  • 385
nimrodm
  • 23,081
  • 7
  • 58
  • 59
  • Have been trying to solve that for quite a long time. Serializing as for itself isn't a big issue, I think the main issue is writing the POST request correctly. Related: http://stackoverflow.com/questions/3864052/web-service-refuses-to-receive-parameters-and-reply-in-json – Oren A Oct 07 '10 at 09:59

2 Answers2

1

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

Kev
  • 118,037
  • 53
  • 300
  • 385
0

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.

jimplode
  • 3,474
  • 3
  • 24
  • 42