tags:

views:

116

answers:

2

Looking over the web, I am finding no answer to this question. I see it being asked and a lot of people being referred to .Net 3.5; however, I am not seeing anything resembling an answer with in the restricted environment of WCF 3.0 (VS2005).

Is it possible for me to do an AJAX/JSON call to a WCF 3.0 Web Service or is the only option to use ASMX if you aren't able to use .Net 3.5?

+1  A: 

There are no out of the box bindings in .NET 3.0 that will allow you to send JSON responses. You will need to implement it yourself. There's an article showing how to do REST with POX. It could be easily adapted to JSON but as you will see there's not negligible amount of work.

Darin Dimitrov
+2  A: 

Microsoft's ASP.NET 2.0 AJAX Extensions 1.0 contains classes to serialize and deserialize JSON for .NET 2.0 and newer.

The class that does it is System.Web.Script.Serialization.JavaScriptSerializer.

Note that even though the documentation linked above is for the 3.5 version, the 3.5 version is identical to the 2.0 version, because it was deprecated and replaced in 3.5 by the classes in System.Runtime.Serialization.Json.

I'm not really sure how to use this with WCF, though... the only time I used it was as an ashx handler.

R. Bemrose