Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Java by (9.5k points)

Below is the code I’ve to implement the JavaScriptSerializer to parse a JSON string from a server:

responseFromServer = readStream.ReadLine();

JavaScriptSerializer ser = new JavaScriptSerializer();

var dict = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(responseFromServer);

var status = dict["notificationType"]; 

Debug.WriteLine(status);

I added using System.Web.Script.Serialization;

Below is the error I get in Visual C# 2010 Express:

“namespace name Script does not exist in the namespace System.Web. As a result the JavaScriptSerializer is not valid.”

Can anyone tell me how I can go about this?

1 Answer

0 votes
by (19.7k points)

 You should add JavaScriptSerializer which you can find in System.Web.Extensions Assembly to the project references. Refer this for further information. 

Interested in Java? Check out this Java tutorial by Intellipaat.  

Browse Categories

...