Json.NET & C# – Installing Json.NET for C# projects in Visual Studio 2015


This content was proof-read by Grammarly. You can Try Grammary for FREE

Json.NET is one of the popular high performance and open source JSON framework for the .NET Developers.

It lets the developers to serialize and deserialize .NET objects and is considered to be one of the most popular .NET library. The first version of Json.NET was released sometime in June 2006 and now this library is used is most of the popular .NET open source projects like Mono , RavebDB , ASP.NET SignalR , ASP.NET Web API , Microsoft HTTP service framework etc.

Json.NET is currently supported in most of the project types in Visual Studio 2015 which includes .NET 2, .NET 3.5, .NET 4, .NET 4.5, Silverlight, Windows Phone and Windows 8 Store App,Universal Windows Platform applications etc.

How to Install Json.NET for your C# projects in Visual Studio 2015 ?

Installing Json.NET for your C# project in Visual Studio 2015 is pretty easier.  You can install it from the NuGet package.

To install Json.NET in Visual Studio 2015 for C# projects , follow the below steps .

1. Open your C# project (Eg : Console Application here) in Visual Studio 2015 .

2. In Visual Studio IDE , Navigate to Tools –> NuGet Package Manager –> Package Manager Console.

image

3. In the Package Manager Console Window , enter the following command and press the enter key.

Install-Package Newtonsoft.Json

image

With in few minutes , you will see the Newtonsoft.Json library be downloaded and installed in your project and you will be displayed a message in the Package Manager console similar to this .

Successfully installed ‘Newtonsoft.Json 8.0.2’ to ACConsoleCSharp

You will also be shown the webpage of the Json.NET within Visual Studio 2015 showing the version of Json.NET installed in your project.

image

4. To confirm if the Json.NET in installed in your project , you can open the solution explorer of your project in Visual Studio and expand the references folder to see the list of dll’s referred in the project. You should see Newtonsoft.Json here.

image

5. Additionally , open the packages.config file from solution explorer to see the following content.

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" />
</packages>

This indicates the Newtonsoft.Json version that is installed and the target framework.

6. Build the project and start using the Json.NET in your project.

Watch out for the other articles on Json.NET and how you can use it in your C# projects at abundantcode.com

%d bloggers like this: