nimrodm
nimrodm

Reputation: 23839

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 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.

Upvotes: 1

Views: 3060

Answers (2)

Kev
Kev

Reputation: 119846

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

Upvotes: 1

jimplode
jimplode

Reputation: 3512

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.

Upvotes: 0

Related Questions