Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type or namespace name 'Json' does not exist in the namespace 'System' (are you missing an assembly reference?)

Tags:

json

.net

object

I am using .NET Framework 4.5 and I'm having this issue. The type or namespace 'Json' does not exist in the namespace 'System'

I tried to Install-Package System.Json -Version 4.0.20126.16343 but I had this issue afterwards.

The type 'System.Uri' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Source: https://www.nuget.org/packages/System.Json

Any ideas would be really appreciated!

like image 960
Katsifaris Avatar asked Jun 16 '15 09:06

Katsifaris


2 Answers

That package is discontinued and shouldn't be used any more.

If you have a console application, I could recommend two options:

  • JSON.NET. Not a part of the .NET Framework itself, but much faster than Microsofts implementation;
  • Microsofts implementation of the JavaScriptSerializer.

Both are capable of reading and writing JSON. I find the JSON.NET library easier to use and more feature complete.

like image 133
Patrick Hofman Avatar answered Nov 04 '22 18:11

Patrick Hofman


using Newtonsoft.Json; should get the job done.

Now you can use:

JsonConvert.SerializeObject
JsonConvert.DeserializeObject
like image 1
Jorge García Avatar answered Nov 04 '22 18:11

Jorge García