Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Restores Newtonsoft.JSON as the default serializer for RestSharp.

License

Notifications You must be signed in to change notification settings

adamfisher/RestSharp.Serializers.Newtonsoft.Json

Repository files navigation

RestSharp.Serializers.Newtonsoft.Json

DEPRECATED -- This library is no longer necessary since RestSharp has decided to bring back Newtonsoft.JSON support in v107.0. If you are using a version of RestSharp earlier than that, then this library may still be useful to you but will be unmaintained.

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.