Jaguar Jaguar - 4 months ago 33
JSON Question

how to import JsonConvert in C# application?

I created a C# library project. The project has this line in one class:

JsonConvert.SerializeObject(objectList);


I'm getting error saying
the name JsonConvert doesn't exist in the current context
. To fix that I added
System.ServiceModel.Web.dll
to references but no luck :(. How can I solve this error?

Answer

JsonConvert is from the namespace Newtonsoft.Json, not System.ServiceModel.Web

Use NuGet to download the package

"Manage NuGet packages" -> Search for "newtonsoft json". -> click "install".