In this tutorial: http://www.asp.net/web-api/videos/getting-started/custom-validation Jon uses
dynamic error = new JsonObject();
with
Using System.json will not work for .Net 4 framework. The library is deprecated. To check it try:
That means, it is deprecated.
The Json object works only from Controller class and not outside. Even if we refer System.Web.MVC outside controller, we have access only to JsonResult and not to Json as Json object is protected object of JsonResult. Please refer the below documentation which explains that,
http://msdn.microsoft.com/en-us/library/dd504936(v=vs.118).aspx
http://www.webcosmoforums.com/asp/32551-type-namespace-name-json-does-not-exist-namespace-system-runtime-serialization.html
Most likely you are missing a reference to System.ServiceModel.Web
Make sure your application is targeting the .Net 4.5 framework in the project properties.
The System.Json objects are only available in 4.5
Edit:
Use Nuget to install system.json : 'Install-Package System.Json'
How to parse JSON without JSON.NET library?
Try this:
PM> Install-Package System.Json -Version 4.0.20126.16343
Per: http://nuget.org/packages/System.Json
It worked!
If you have questions on how to add enter nuget code, please follow the link below: http://docs.nuget.org/docs/start-here/using-the-package-manager-console
If you want to use other .Net json serializer, you can use the following:
for more details, follow - http://netfx.codeplex.com/