Problem
I can’t seem to find the JavaScriptSerializer or the System objects. Within Visual Studio 2010, the namespace Web.Script.Serialization is used. What method should I use to serialize something to JSON?
Yes, System.Web.Extensions (in System.Web.Extensions.dll) was already included in the project. Which is why I’m surprised.
Asked by Prisoner ZERO
Solution #1
Check that System.Web.Extensions is in the.net 4 version – there is a 3.5 version as well, but I don’t think it works.
These steps have shown to be effective for me:
Answered by Steffen
Solution #2
using System.Web.Script.Serialization;
Answered by Scott Johnson
Solution #3
From the first Google search result:
http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
As a result, reference System.Web.Extensions.dll.
Answered by Paul
Solution #4
I’m using Visual Studio 2015 and came upon this topic by chance.
Yes, in order to make advantage of
JavaScriptSerializer json = new JavaScriptSerializer();
Right-click on references and select Assemblies –> Framework from the context menu.
System.Web.Extensions
Then provide your citation.
using System.Web.Script.Serialization;
Answered by Tom Stickel
Solution #5
This is how you may make JavaScriptSerializer available in your.NET 4.0 application (full)
using System.Web.Script.Serialization;
You should be able to build a new JavaScriptSerializer object as a result of this!
Answered by Alex Hopkins
Post is based on https://stackoverflow.com/questions/7000811/cannot-find-javascriptserializer-in-net-4-0