System.Net.Http.Json 8.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package System.Net.Http.Json --version 8.0.0
NuGet\Install-Package System.Net.Http.Json -Version 8.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="System.Net.Http.Json" Version="8.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add System.Net.Http.Json --version 8.0.0
#r "nuget: System.Net.Http.Json, 8.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.
// Install System.Net.Http.Json as a Cake Addin
#addin nuget:?package=System.Net.Http.Json&version=8.0.0

// Install System.Net.Http.Json as a Cake Tool
#tool nuget:?package=System.Net.Http.Json&version=8.0.0

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

  • Extension methods for deserializing HTTP response JSON bodies.
  • Extension methods for serializing HTTP request JSON bodies.
  • Extension methods for deserializing JSON from HttpContent instances.

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:

  • HttpClientJsonExtensions
  • HttpContentJsonExtensions

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 is compatible.  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 is compatible.  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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (598)

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

Package Downloads
Refit The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

The automatic type-safe REST library for Xamarin and .NET

Dapr.Client The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

This package contains the reference assemblies for developing services using Dapr.

OpenIddict.Validation.SystemNetHttp The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

System.Net.Http integration package for the OpenIddict validation services.

AspNetCore.HealthChecks.OpenIdConnectServer

HealthChecks.OpenIdConnectServer is the health check package for OpenIdConnect servers

StrawberryShake.Transport.Http

GraphQL over HTTP transport implementation for StrawberryShake GraphQL clients.

GitHub repositories (184)

Showing the top 5 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.
dotnet-architecture/eShopOnWeb
Sample ASP.NET Core 8.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
restsharp/RestSharp
Simple REST and HTTP API Client for .NET
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.
MudBlazor/MudBlazor
Blazor Component Library based on Material design with an emphasis on ease of use. Mainly written in C# with Javascript kept to a bare minimum it empowers .NET developers to easily debug it if needed.
Version Downloads Last updated
9.0.0-preview.3.24172.9 235 4/11/2024
9.0.0-preview.2.24128.5 923 3/12/2024
9.0.0-preview.1.24080.9 1,177 2/13/2024
8.0.0 1,474,787 11/14/2023
8.0.0-rc.2.23479.6 53,465 10/10/2023
8.0.0-rc.1.23419.4 8,023 9/12/2023
8.0.0-preview.7.23375.6 19,879 8/8/2023
8.0.0-preview.6.23329.7 2,336 7/11/2023
8.0.0-preview.5.23280.8 3,298 6/13/2023
8.0.0-preview.4.23259.5 4,575 5/16/2023
8.0.0-preview.3.23174.8 11,953 4/11/2023
8.0.0-preview.2.23128.3 8,580 3/14/2023
8.0.0-preview.1.23110.8 2,994 2/21/2023
7.0.1 10,282,972 3/14/2023
7.0.0 2,620,147 11/7/2022
7.0.0-rc.2.22472.3 12,054 10/11/2022
7.0.0-rc.1.22426.10 9,060 9/14/2022
7.0.0-preview.7.22375.6 3,732 8/9/2022
7.0.0-preview.6.22324.4 3,835 7/12/2022
7.0.0-preview.5.22301.12 1,946 6/14/2022
7.0.0-preview.4.22229.4 5,186 5/10/2022
7.0.0-preview.3.22175.4 2,405 4/13/2022
7.0.0-preview.2.22152.2 3,133 3/14/2022
7.0.0-preview.1.22076.8 1,322 2/17/2022
6.0.2-mauipre.1.22102.15 10,775 2/15/2022
6.0.2-mauipre.1.22054.8 14,191 1/19/2022
6.0.1 948,458 3/14/2023
6.0.0 37,792,253 11/8/2021
6.0.0-rc.2.21480.5 21,033 10/12/2021
6.0.0-rc.1.21451.13 14,008 9/14/2021
6.0.0-preview.7.21377.19 15,051 8/10/2021
6.0.0-preview.6.21352.12 10,368 7/14/2021
6.0.0-preview.5.21301.5 8,612 6/15/2021
6.0.0-preview.4.21253.7 6,210 5/24/2021
6.0.0-preview.3.21201.4 9,514 4/8/2021
6.0.0-preview.2.21154.6 3,636 3/11/2021
6.0.0-preview.1.21102.12 15,445 2/12/2021
5.0.0 29,435,670 11/9/2020
5.0.0-rc.2.20475.5 34,623 10/13/2020
5.0.0-rc.1.20451.14 27,149 9/14/2020
5.0.0-preview.8.20407.11 12,015 8/25/2020
5.0.0-preview.7.20364.11 7,938 7/21/2020
5.0.0-preview.6.20305.6 11,625 6/25/2020
5.0.0-preview.5.20278.1 5,061 6/10/2020
5.0.0-preview.4.20251.6 21,720 5/18/2020
5.0.0-preview.3.20214.6 51,713 4/23/2020
3.2.1 11,957,070 6/9/2020
3.2.0 1,116,385 5/18/2020
3.2.0-rc1.20217.1 60,375 4/30/2020
3.2.0-preview5.20210.3 30,148 4/16/2020
3.2.0-preview3.20175.8 25,034 3/26/2020