Friday, May 17, 2024
Homepage · c#
 Popular · Latest · Hot · Upcoming
75
rated 0 times [  82] [ 7]  / answers: 1 / hits: 42300  / 11 Years ago, wed, september 11, 2013, 12:00:00

I am having a problem trying to implement the JavaScriptSerializer to parse a JSON string received from a server.



I implemented the following code:



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;



Visual C# 2010 Express is telling me the namespace name Script does not exist in the namespace System.Web. As a result the JavaScriptSerializer is not valid.



What am I missing to use this, or is there a better way to parse the JSON string?


More From » c#

 Answers
29

JavaScriptSerializer is situated in System.Web.Extensions Assembly. You should add it to your project references.



You can get this information in MSDN




Assembly: System.Web.Extensions (in System.Web.Extensions.dll)



[#75754] Tuesday, September 10, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mustafaericho

Total Points: 322
Total Questions: 103
Total Answers: 110

Location: Montenegro
Member since Thu, Jun 16, 2022
2 Years ago
mustafaericho questions
Mon, May 31, 21, 00:00, 3 Years ago
Sun, May 23, 21, 00:00, 3 Years ago
Sat, Feb 13, 21, 00:00, 3 Years ago
Sat, Jan 2, 21, 00:00, 3 Years ago
Thu, Nov 12, 20, 00:00, 4 Years ago
;