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

Published on February 13, 2016 by abundantcode

Filed under Json.NET

Last modified February 13, 2016

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 9319 times

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

Leave a Comment


x

You might be Interested in these Posts

How to decode a base64 string in C#?

Here's a sample code snippet demonstrating how you can easily decode a base64 encoded string in C#. ...

How to disable editing of items in a combo box in c#?

When working in Win forms using C# and especially when you use the combo box , you would have notice...

C# Program to find the ASCII Value of a Character

Problem Write a program in Visual C# to find the ASCII value of the input character. How to find t...