Json does not exist in the name system

In this tutorial: http://www.asp.net/web-api/videos/getting-started/custom-validation John uses

dynamic error = new JsonObject(); 

from

 using System.Json; 

I assume this is JsonObject here: http://msdn.microsoft.com/en-us/library/system.json.jsonobject(v=vs.110).aspx located in:

  • Namespace: System.Json
  • Build: System.Runtime.Serialization (in System.Runtime.Serialization.dll)

I added the System.Runtime.Serialization link, but still can not find System.Json.

Am I reading Microsoft documents incorrectly? (I am using .NET 4.5)

+16
json asp.net-web-api
Oct 12 '12 at 12:41
source share
5 answers

Try the following:

 PM> Install-Package System.Json -Version 4.0.20126.16343 

Per: http://nuget.org/packages/System.Json

It worked!

If you have questions about how to add nuget input code, follow the link below: http://docs.nuget.org/docs/start-here/using-the-package-manager-console

+31
Dec 13 '12 at 16:17
source share

http://www.webcosmoforums.com/asp/32551-type-namespace-name-json-does-not-exist-namespace-system-runtime-serialization.html

Most likely you are missing a link to System.ServiceModel.Web

Make sure your application is configured on the .Net 4.5 platform in the project properties.

System.Json objects are only available in version 4.5.

Edit:

Use Nuget to install system.json: 'Install-Package System.Json'

How to parse JSON without JSON.NET library?

+7
Oct 12 '12 at 12:45
source share

The Json object only works from the Controller class, not from the outside. Even if we refer to the external System.Web.MVC controller, we only have access to JsonResult, not Json, because the Json object is a JsonResult protection object. Please refer to the documentation below that explains that

http://msdn.microsoft.com/en-us/library/dd504936(v=vs.118).aspx

+3
Nov 11 '14 at 12:06
source share

If you want to use another .net json serializer, you can use the following:

  • go to nuget package management.
  • search json.net.
  • press the install button.

for more details, follow - http://netfx.codeplex.com/

0
Nov 25 '15 at 11:51
source share

Using System.json will not work for .Net 4 framework. The library is out of date. To check this, try:

  • Go Add link ... for the project.
  • The ".Net" tab, Search System.json, you will not find.

This means that it is out of date.

-2
Nov 25 '15 at 12:24
source share



All Articles