RestSharp.Newtonsoft.Json

Restores Newtonsoft.JSON as the default serializer for RestSharp.


Keywords
API, HTTP, JSON, NEWTONSOFT, REST, RESTSHARP, XML, json-serialization, newtonsoft-json, serialization
License
Apache-2.0
Install
Install-Package RestSharp.Newtonsoft.Json -Version 1.5.1

Documentation

RestSharp.Serializers.Newtonsoft.Json

This is a glue library that makes Newtonsoft.JSON the default serializer for RestSharp.

RestSharp removed Newtonsoft.JSON as a dependency in version 103.0 which is great if you don't need all the extra capability Newtonsoft.JSON provides.

After working on several projects and getting annoyed with the limited functionality available in the default JsonSerializer include with .NET, I decided to create this project so I wouldn't have to leave a JSON serialization implementation laying around in my projects. Hopefully it helps someone else too.

Getting Started

Installation

This package is available as a nuget package on nuget.org.

Code

This library makes a NewtonsoftJsonSerializer available which you can readily plug into your RestSharp request object like this:

var request = new RestRequest();
request.JsonSerializer = new NewtonsoftJsonSerializer();

If you don't want to keep initializing every RestRequest, you can also use the RestSharp.Serializers.Newtonsoft.Json.RestRequest class instead of the one from RestSharp. They are named the same but this class will default to using the Newtonsoft.JSON serialization engine.