Prisoner ZERO Prisoner ZERO - 7 months ago 41
C# Question

Cannot find JavaScriptSerializer in .Net 4.0

I cannot seem to find the

object nor the the
namespace within Visual Studio 2010. I need to serialize something to JSON what am I supposed to use?

And yes, I already included the
(in System.Web.Extensions.dll) within the project. Which is why I am shocked?

  • I do know
    was marked as obsolete in 3.5


Check if you included the 4 version of System.Web.Extensions - there's a 3.5 version as well, and I don't think that on works.

These steps work for me:

  1. Create a new console application
  2. Change the target to 4 instead of Client Profile
  3. Add a reference to System.Web.Extensions (4.0)
  4. Got access to JavaScriptSerializer in Program.cs now :-)