3

I'm having trouble parsing Json string to Objects in C#. I'm using this:

JavaScriptSerilizer parser = new JavaScriptSerializer();

but it doesn't recognize the JavaScriptSerilizer, and I can't add this:

using System.Web.Script.Serialization;

but it returns an error, not recognizing the "Script" in "System.Web", and I added "System.Web" in the References. Also, I found "System.Web.Extensions.dll" in "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\", added it as a Reference but I get this error:

Could not resolve assembly "System.Web.Extensions". The assembly is not in the currently targetet framework...

I searched for the same file in lower version but I couldn't find it.

What am I doing wrong?

3 Answers 3

4

That type is implemented in System.Web.Extensions.dll, not in System.Web.dll.

Sign up to request clarification or add additional context in comments.

2 Comments

Could not resolve assembly "System.Web.Extensions". The assembly is not in the currently targetet framework...
@GregaMenih: JavaScriptSerializer is available in .NET 3.5 and .NET 4, and not in .NET 4 Client Profile. You will have to change your target framework.
0

You have to add a reference to System.Web.Extensions in your project.

MSDN: JavaScriptSerializer Class

If you look at the MSDN documentation for a class, it tells you which assembly it's in at the top of the page.

Comments

0

Please add reference to System.Web.Extensions (in System.Web.Extensions.dll) in your project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.