I am trying to use JavaScriptSerializer
in my application.
I initially received
Cannot find JavaScriptSerializer
and I solved it by adding:
using System.Web.Script.Serialization;
But then the sub-keyword Script
is underlined with a blue line:
The type or namespace 'Script' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
So I added to the project a reference to:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.Extensions.dll
That didn't help. I am still receiving the same blue underline with same error. The reference is marked with an exclamation mark yellow warning:
I tried the suggested solutions on this thread, but as @user781490 indicated, they didn't help in my situation.
Any idea how to resolve this?
This question is related to
c#
visual-studio-2010
javascriptserializer
jsonserializer
Since JsonSerializer is deprecated in .Net 4.0+ I used http://www.newtonsoft.com/json to solve this issue.
NuGet- > Install-Package Newtonsoft.Json
I had the same. Script been underlined. I added a reference to System.Web.Extensions. Thereafter the Script was no longer underlined. Hope this helps someone.
Just Add reference to System.Web.Extensions and happy to go.
Source: Stackoverflow.com