I cannot seem to find the JavaScriptSerializer
object nor the the System.Web.Script.Serialization
namespace within Visual Studio 2010. I need to serialize something to JSON what am I supposed to use?
And yes, I already included the System.Web.Extensions
(in System.Web.Extensions.dll) within the project. Which is why I am shocked?
- I do know
System.Web.Extensions
was marked as obsolete in 3.5
is in assembly : System.Web.Extensions (System.Web.Extensions.dll)
Did you include a reference to
System.Web.Extensions
? If you click on your first link it says which assembly it's in.References
and doAdd Reference
, then fromAssemblies->Framework
selectSystem.Web.Extensions
.For those who seem to be following the answers above but still have the problem (e.g., see the first comment on the poster's question):
You are probably working in a solution with many projects. The project you appear to be working in references other projects, but you are actually modifying a file from one of the other projects. For example:
System.Web.Extensions
But if the file you are modifying to use
System.Web.Script.Serialization
is in project B, then you will need to add a reference toSystem.Web.Extension
in project B as well.Check if you included the .net 4 version of
System.Web.Extensions
- there's a 3.5 version as well, but I don't think that one works.These steps work for me:
System.Web.Extensions
(4.0)JavaScriptSerializer
in Program.cs now :-)Just so you know, I am using Visual Studio 2013 and have had the same problem until I used the Project Properties to switch to 3.5 framework and back to 4.5. This for some reason registered the .dll properly and I could use the System.Web.Extensions.