System.Net.Http.Json 9.0.4 (original) (raw)

About

Provides extension methods for System.Net.Http.HttpClient and System.Net.Http.HttpContent that facilitate serialization and deserialization of HTTP requests using System.Text.Json.

Key Features

How to Use

using System.Net.Http.Json;

using var client = new HttpClient();

// Get the list of all books
Book[] books = await client.GetFromJsonAsync<Book[]>("https://api.contoso.com/books");

// Send a POST request to add a new book
var book = new Book(id: 42, "Title", "Author", publishedYear: 2023);
HttpResponseMessage response = await client.PostAsJsonAsync($"https://api.contoso.com/books/{book.id}", book);

if (response.IsSuccessStatusCode)
    Console.WriteLine("Book added successfully.");
else
    Console.WriteLine($"HTTP request failed with status code: {response.StatusCode}");

public record Book(int id, string title, string author, int publishedYear);

Main Types

The main types provided by this library are:

Additional Documentation

Feedback & Contributing

System.Net.Http.Json is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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.
.NET Core netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed.
.NET Standard netstandard2.0 is compatible. netstandard2.1 was computed.
.NET Framework net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed.
MonoAndroid monoandroid was computed.
MonoMac monomac was computed.
MonoTouch monotouch was computed.
Tizen tizen40 was computed. tizen60 was computed.
Xamarin.iOS xamarinios was computed.
Xamarin.Mac xamarinmac was computed.
Xamarin.TVOS xamarintvos was computed.
Xamarin.WatchOS xamarinwatchos was computed.

NuGet packages (792)

Showing the top 5 NuGet packages that depend on System.Net.Http.Json:

Package Downloads
Refit The automatic type-safe REST library for Xamarin and .NET 113.4M
Aspose.PDF Aspose.PDF for .NET is a PDF document creation and manipulation component that enables your .NET applications to read, write and manipulate existing PDF documents without using Adobe Acrobat. It also allows you to create forms and manage form fields embedded in a PDF document. This component is written in managed C# and it allows developers to add PDF creation and manipulation functionality to their Microsoft .NET applications (WinForms, ASP.NET and .NET Compact Framework). Aspose.PDF for .NET is affordable and offers an incredible wealth of features including PDF compression options; table creation and manipulation; support for graph objects; extensive hyperlink functionality; extended security controls; custom font handling; integration with data sources; add or remove bookmarks; create table of contents; add, update, delete attachments and annotations; import or export PDF form data; add, replace or remove text and images; split, concatenate, extract or insert pages; transform pages to image; print PDF documents and much more. 35.1M
OpenIddict.Validation.SystemNetHttp System.Net.Http integration package for the OpenIddict validation services. 12.0M
AspNetCore.HealthChecks.OpenIdConnectServer HealthChecks.OpenIdConnectServer is the health check package for OpenIdConnect servers 9.5M
OpenIddict.Client.SystemNetHttp System.Net.Http integration package for the OpenIddict client services. 6.1M

GitHub repositories (189)

Showing the top 20 popular GitHub repositories that depend on System.Net.Http.Json:

Repository Stars
dotnet/runtime .NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps. 16.3K
dotnet-architecture/eShopOnWeb Sample ASP.NET Core 8.0 reference application, now community supported: https://github.com/NimblePros/eShopOnWeb 10.4K
restsharp/RestSharp Simple REST and HTTP API Client for .NET 9.7K
unoplatform/uno Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!! 9.3K
reactiveui/refit The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface. 9.0K
MudBlazor/MudBlazor Blazor Component Library based on Material Design principles with an emphasis on ease of use and extensibility 9.0K
ant-design-blazor/ant-design-blazor 🌈A rich set of enterprise-class UI components based on Ant Design and Blazor. 6.0K
ServiceStack/ServiceStack Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all 5.5K
openiddict/openiddict-core Flexible and versatile OAuth 2.0/OpenID Connect stack for .NET 4.8K
dotnetcore/WTM Use WTM to write .netcore app fast !!! 4.3K
Xabaril/AspNetCore.Diagnostics.HealthChecks Enterprise HealthChecks for ASP.NET Core Diagnostics Package 4.2K
fullstackhero/blazor-starter-kit Clean Architecture Template for Blazor WebAssembly Built with MudBlazor Components. 3.6K
dremin/RetroBar Classic Windows 95, 98, Me, 2000, XP, Vista taskbar for modern versions of Windows 3.3K
betalgo/openai .NET library for the OpenAI service API by Betalgo Ranul 3.0K
dotnet/extensions This repository contains a suite of libraries that provide facilities commonly needed when creating production-ready applications. 2.9K
dotnet/sdk Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI 2.9K
Jeric-X/SyncClipboard 跨平台剪贴板同步方案 / Cross-Platform Cipboard Syncing Solution 2.4K
dotnet/Docker.DotNet 🐋 .NET (C#) Client Library for Docker API 2.3K
phongnguyend/Practical.CleanArchitecture Full-stack .Net 9 Clean Architecture (Microservices, Modular Monolith, Monolith), Blazor, Angular 19, React 19, Vue 3.5, BFF with YARP, NextJs 15, Domain-Driven Design, CQRS, SOLID, Asp.Net Core Identity Custom Storage, OpenID Connect, EF Core, OpenTelemetry, SignalR, Background Services, Health Checks, Rate Limiting, Clouds (Azure, AWS, GCP), .. 2.3K
Nethereum/Nethereum Ethereum .Net cross platform integration library 2.2K
Version Downloads Last updated
10.0.0-preview.3.25171.5 1,085 4/10/2025
10.0.0-preview.2.25163.2 1,242 3/18/2025
10.0.0-preview.1.25080.5 1,341 2/25/2025
9.0.4 136,227 4/8/2025
9.0.3 210,281 3/11/2025
9.0.2 278,838 2/11/2025
9.0.1 344,660 1/14/2025
9.0.0 870,601 11/12/2024
9.0.0-rc.2.24473.5 32,935 10/8/2024
9.0.0-rc.1.24431.7 15,148 9/10/2024
9.0.0-preview.7.24405.7 4,009 8/13/2024
9.0.0-preview.6.24327.7 2,644 7/9/2024
9.0.0-preview.5.24306.7 6,597 6/11/2024
9.0.0-preview.4.24266.19 8,667 5/21/2024
9.0.0-preview.3.24172.9 2,830 4/11/2024
9.0.0-preview.2.24128.5 2,211 3/12/2024
9.0.0-preview.1.24080.9 2,206 2/13/2024
8.0.1 2,921,365 10/8/2024
8.0.0 16,539,052 11/14/2023
8.0.0-rc.2.23479.6 128,438 10/10/2023
8.0.0-rc.1.23419.4 11,686 9/12/2023
8.0.0-preview.7.23375.6 28,272 8/8/2023
8.0.0-preview.6.23329.7 2,519 7/11/2023
8.0.0-preview.5.23280.8 3,759 6/13/2023
8.0.0-preview.4.23259.5 5,003 5/16/2023
8.0.0-preview.3.23174.8 12,839 4/11/2023
8.0.0-preview.2.23128.3 13,649 3/14/2023
8.0.0-preview.1.23110.8 3,551 2/21/2023
7.0.1 22,160,767 3/14/2023
7.0.0 3,823,067 11/7/2022
7.0.0-rc.2.22472.3 12,366 10/11/2022
7.0.0-rc.1.22426.10 18,230 9/14/2022
7.0.0-preview.7.22375.6 4,490 8/9/2022
7.0.0-preview.6.22324.4 4,134 7/12/2022
7.0.0-preview.5.22301.12 2,127 6/14/2022
7.0.0-preview.4.22229.4 5,454 5/10/2022
7.0.0-preview.3.22175.4 2,776 4/13/2022
7.0.0-preview.2.22152.2 3,457 3/14/2022
7.0.0-preview.1.22076.8 1,521 2/17/2022
6.0.2 153,334 11/12/2024
6.0.1 2,152,219 3/14/2023
6.0.0 52,878,598 11/8/2021
6.0.0-rc.2.21480.5 23,943 10/12/2021
6.0.0-rc.1.21451.13 14,328 9/14/2021
6.0.0-preview.7.21377.19 15,899 8/10/2021
6.0.0-preview.6.21352.12 10,647 7/14/2021
6.0.0-preview.5.21301.5 9,999 6/15/2021
6.0.0-preview.4.21253.7 6,500 5/24/2021
6.0.0-preview.3.21201.4 10,138 4/8/2021
6.0.0-preview.2.21154.6 3,857 3/11/2021
6.0.0-preview.1.21102.12 20,655 2/12/2021
5.0.0 38,783,147 11/9/2020 5.0.0 is deprecated because it is no longer maintained.
5.0.0-rc.2.20475.5 41,090 10/13/2020
5.0.0-rc.1.20451.14 28,391 9/14/2020
5.0.0-preview.8.20407.11 12,468 8/25/2020
5.0.0-preview.7.20364.11 8,199 7/21/2020
5.0.0-preview.6.20305.6 12,226 6/25/2020
5.0.0-preview.5.20278.1 5,527 6/10/2020
5.0.0-preview.4.20251.6 22,324 5/18/2020
5.0.0-preview.3.20214.6 53,895 4/23/2020
3.2.1 15,221,601 6/9/2020 3.2.1 is deprecated because it is no longer maintained.
3.2.0 1,348,464 5/18/2020 3.2.0 is deprecated because it is no longer maintained.
3.2.0-rc1.20217.1 61,791 4/30/2020 3.2.0-rc1.20217.1 is deprecated because it is no longer maintained.
3.2.0-preview5.20210.3 31,820 4/16/2020 3.2.0-preview5.20210.3 is deprecated because it is no longer maintained.
3.2.0-preview3.20175.8 25,968 3/26/2020 3.2.0-preview3.20175.8 is deprecated because it is no longer maintained.