Refit.Newtonsoft.Json 16.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.

Requires NuGet 2.12 or higher.

dotnet add package Refit.Newtonsoft.Json --version 16.0.0
                    
NuGet\Install-Package Refit.Newtonsoft.Json -Version 16.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Refit.Newtonsoft.Json" Version="16.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Refit.Newtonsoft.Json" Version="16.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Refit.Newtonsoft.Json" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Refit.Newtonsoft.Json --version 16.0.0
                    
#r "nuget: Refit.Newtonsoft.Json, 16.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Refit.Newtonsoft.Json@16.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Refit.Newtonsoft.Json&version=16.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Refit.Newtonsoft.Json&version=16.0.0
                    
Install as a Cake Tool

Refit

Refit

Build NuGet

Refit turns a C# interface into an HTTP client. Attributes describe the request method, URL, headers and body. The source generator builds its implementation when your app compiles. Your app keeps control of HttpClient, cancellation and serialization.

Start with the Refit documentation. It explains the concepts, walks through a first request, and links each topic to runnable source examples. Examples use .NET 10 and C# 14 unless they state another target. Website code blocks can show a subset of a complete example and omit its test setup.

Packages

Package Purpose
Refit Generated HTTP clients, request attributes, serializers and response types. Includes the generator, interface analyzers and code fixes.
Refit.HttpClientFactory Register clients with dependency injection and IHttpClientFactory, including generated-only and keyed registrations.
Refit.Testing Match outgoing requests, supply local replies, verify calls and simulate network faults.
Refit.Newtonsoft.Json Serialize content with Newtonsoft.Json.
Refit.Xml Serialize XML content.
Refit.Reflection Optional request building through runtime reflection. Use generated clients for trimmed and Native AOT apps.

System.Text.Json with generated metadata is the preferred JSON setup. See JSON configuration and AOT guidance.

What you can build

Surface Documentation
HTTP methods, route placeholders and request inspection Routes
Scalar, object and collection queries; formatting and converters Queries
Static and dynamic headers, authorization and request state Headers and request context
Serialized bodies, forms, buffering and request compression Bodies
Task<T>, ValueTask<T>, IObservable<T> and response wrappers Return types and responses
Streamed JSON arrays, JSON Lines and server-sent events Streaming
HTTP, transport and deserialization failures Errors
Local replies, request verification and simulated faults Testing

See why use Refit for equivalent manual HTTP code and trade-offs. The website records known behavior discrepancies beside the affected APIs.

Public API map

Use the full API reference to find types, overloads, parameters and return values across all topics on one page.

Public method group Brief description Documentation
HTTP verb and route attributes Declare the HTTP method, route template, base-path prefix and URL resolution behavior. Routes
Query attributes and formatters Add scalar, object, collection, flag, encoded, formatted and converted query values. Queries, formatters and converters
Headers, authorization and request context Add shared or per-call headers, obtain tokens and attach local handler state. Headers and request context
Bodies, forms, multipart and compression Serialize request bodies, send forms, files or streams, choose buffering and apply request compression. Bodies and multipart
Client creation and request builders Create generated or reflection clients, create owned HttpClient instances and supply request builders. Client creation and request builders
Settings and request metadata Configure serializers, formatters, exception factories, transport behavior, request options, timeouts, versions and URL resolution. Settings, metadata and helpers
Return types, responses and adapters Choose Task, ValueTask, IObservable<T>, IAsyncEnumerable<T>, response wrappers and custom return adapters. Return types, responses, streaming and adapters
Errors and problem details Read typed error content, create or transform API and transport exceptions, enforce success and redact sensitive details. Errors
Content serializers Use System.Text.Json, JSON Lines, synchronous or streaming serializer capabilities and custom serializers. JSON and content
Alternate serializers Configure Newtonsoft.Json and XML serializers with their settings. Newtonsoft.Json and XML
HTTP client factory and dependency injection Register generated, reflection or keyed clients, settings holders and authorization providers. Dependency injection
Testing routes, replies, faults and verification Match requests, create replies, inject failures or delays, inspect bodies and verify calls. Testing
Advanced generated request helpers Extend or inspect request construction through query builders, parameter providers and helper contracts. Query builder and request helpers

Build requirements and targets

The source generator requires Roslyn 4.8 or newer and PackageReference. .NET SDK 8.0.100 and Visual Studio 2022 17.8 provide that compiler baseline. These build requirements are separate from the application's target framework.

The source projects target .NET 8, 9, 10 and 11, plus .NET Framework 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 and 4.8.1. Availability of individual framework features can differ. Read the AOT guide before choosing reflection-dependent APIs for a trimmed or native app.

Examples and changes

Build every complete documentation example from src:

dotnet build Refit.slnx -c Release

Each website page links to its own project under examples/Documentation/Pages. Run a page project, such as examples/Documentation/Pages/requests-routes/requests-routes.csproj, to check its local reply assertions without contacting a live service. The documentation examples README lists the source layout and independent projects.

See breaking changes, GitHub releases, and contributing.

Sponsors

JetBrains Claude

Refit is licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 is compatible.  net471 is compatible.  net472 is compatible.  net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (99)

Showing the top 5 NuGet packages that depend on Refit.Newtonsoft.Json:

Package Downloads
N3O.Umbraco.Extensions

TODO

Apple.Receipt.Verificator

Library for validating receipts with the App Store

Meraki.Api

Meraki API

Alexa.NET.Management

A .NET Core library for handling Alexa Skills Management API

Umbraco.Headless.Client.Net

.NETStandard client library for the Umbraco Headless APIs

GitHub repositories (11)

Showing the top 11 popular GitHub repositories that depend on Refit.Newtonsoft.Json:

Repository Stars
ErsatzTV/legacy
Open-source platform that transforms your personal media library into live, custom TV channels.
GoldenPotato137/PotatoVN
一款Visual Novel管理软件
dorisoy/Dorisoy.Pan
Dorisoy.Pan 是基于 .NET 10 的跨平台文档管理系统,使用 MS SQL 2012 / MySQL 8.0(或更高版本)后端数据库,您可以在 Windows、Linux 或 Mac 上运行它。项目中的所有方法都是异步的,支持 JWT 令牌身份验证,项目体系结构遵循 CQRS + MediatR 模式和最佳安全实践。源代码完全可定制,热插拔且清晰的体系结构,使开发定制功能和遵循任何业务需求变得容易。
roubachof/Sharpnado.TaskLoaderView
Free yourself from IsBusy=true! The `TaskLoaderView` is a UI component that handles all your UI loading state (Loading, Error, Result, Notification), and removes all the pain of async loading from your view models (try catch / async void / IsBusy / HasErrors / base view models / ...) thanks to its brother the `TaskLoaderNotifier`.
Strypper/mauisland
MAUIsland 🏝️ is the number 1 controls gallery for .NET MAUI
whuanle/maomi
Maomi 框架是一个简单的、简洁的开发框架,除了框架本身提供的功能之外,Maomi 还作为一个易于阅读的开源项目,能够给开发者提供设计框架的思路和代码。
Respawnsive/Apizr
Refit based web api client management, but resilient (retry, connectivity, cache, auth, log, priority, etc...)
Cyenoch/Coolapk-UWP
Coolapk UWP edition
Quantower/Examples
Examples of an additional modules for Quantower trading platform
netcorepal/d3shop
An online shop project based on Domain-Driven Design
surveysolutions/surveysolutions
Survey Solutions is a survey management and data collection system developed by the World Bank.
Version Downloads Last Updated
16.1.0 1,322 9/21/2026
16.0.0 499 9/20/2026
15.2.0 79,738 8/18/2026
15.1.0 23,977 8/15/2026
15.0.0 27,459 8/5/2026
15.0.0-beta.1 70 8/3/2026
14.0.1 98,641 7/26/2026
14.0.0 4,240 7/25/2026
14.0.0-beta.5 109 7/22/2026
14.0.0-beta.4 86 7/20/2026
14.0.0-beta.3 89 7/20/2026
14.0.0-beta.2 100 7/16/2026
14.0.0-beta.1 79 7/15/2026
13.1.0 82,454 7/3/2026
13.0.0 8,518 7/1/2026
12.1.0 68,184 6/29/2026
12.0.0 13,112 6/24/2026
11.2.0 52,546 6/18/2026
11.1.0 7,206 6/17/2026
11.0.1 123,146 6/4/2026
Loading failed