System.Net.Http.Json 10.0.0-preview.3.25171.5

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.

Showing the top 20 packages that depend on System.Net.Http.Json.

Packages Downloads
OpenIddict.Client.SystemNetHttp
System.Net.Http integration package for the OpenIddict client services.
12
Refit
The automatic type-safe REST library for Xamarin and .NET
18
Refit
The automatic type-safe REST library for Xamarin and .NET
19
Refit
The automatic type-safe REST library for Xamarin and .NET
20
Refit
The automatic type-safe REST library for Xamarin and .NET
22
Refit
The automatic type-safe REST library for Xamarin and .NET
36
Refit
The automatic type-safe REST library for Xamarin and .NET
37
Refit
The automatic type-safe REST library for Xamarin and .NET
38
Refit
The automatic type-safe REST library for Xamarin and .NET
39
Refit
The automatic type-safe REST library for Xamarin and .NET
40
Refit
The automatic type-safe REST library for Xamarin and .NET
42
Refit
The automatic type-safe REST library for Xamarin and .NET
43
Refit
The automatic type-safe REST library for Xamarin and .NET
50

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

.NET Standard 2.0

.NET 10.0

  • No dependencies.

.NET 8.0

.NET 9.0

Version Downloads Last updated
10.0.0-preview.3.25171.5 5 04/11/2025
10.0.0-preview.2.25163.2 5 04/02/2025
10.0.0-preview.1.25080.5 5 04/02/2025
9.0.4 4 04/11/2025
9.0.3 4 04/02/2025
9.0.2 4 04/02/2025
9.0.1 6 03/31/2025
9.0.0 11 11/14/2024
9.0.0-rc.2.24473.5 10 10/23/2024
9.0.0-rc.1.24431.7 12 09/19/2024
9.0.0-preview.7.24405.7 8 10/23/2024
9.0.0-preview.6.24327.7 12 10/21/2024
9.0.0-preview.5.24306.7 13 09/20/2024
9.0.0-preview.4.24266.19 12 10/21/2024
9.0.0-preview.3.24172.9 10 10/23/2024
9.0.0-preview.2.24128.5 11 10/23/2024
9.0.0-preview.1.24080.9 13 10/23/2024
8.0.1 12 10/21/2024
8.0.0 12 10/21/2024
8.0.0-rc.2.23479.6 10 10/21/2024
8.0.0-rc.1.23419.4 8 10/23/2024
8.0.0-preview.7.23375.6 10 09/20/2024
8.0.0-preview.6.23329.7 9 10/23/2024
8.0.0-preview.5.23280.8 12 09/20/2024
8.0.0-preview.4.23259.5 10 10/23/2024
8.0.0-preview.3.23174.8 12 09/20/2024
8.0.0-preview.2.23128.3 9 09/20/2024
8.0.0-preview.1.23110.8 9 10/23/2024
7.0.1 12 10/21/2024
7.0.0 12 10/21/2024
7.0.0-rc.2.22472.3 11 09/20/2024
7.0.0-rc.1.22426.10 9 10/23/2024
7.0.0-preview.7.22375.6 12 10/21/2024
7.0.0-preview.6.22324.4 10 10/23/2024
7.0.0-preview.5.22301.12 10 10/21/2024
7.0.0-preview.4.22229.4 11 10/23/2024
7.0.0-preview.3.22175.4 12 10/23/2024
7.0.0-preview.2.22152.2 9 09/20/2024
7.0.0-preview.1.22076.8 9 09/20/2024
6.0.2 10 11/14/2024
6.0.1 11 10/21/2024
6.0.0 10 10/21/2024
6.0.0-rc.2.21480.5 12 09/20/2024
6.0.0-rc.1.21451.13 10 10/23/2024
6.0.0-preview.7.21377.19 13 10/21/2024
6.0.0-preview.6.21352.12 12 10/21/2024
6.0.0-preview.5.21301.5 9 10/23/2024
6.0.0-preview.4.21253.7 13 10/23/2024
6.0.0-preview.3.21201.4 12 10/23/2024
6.0.0-preview.2.21154.6 10 10/23/2024
6.0.0-preview.1.21102.12 12 10/21/2024
5.0.0 10 09/20/2024
5.0.0-rc.2.20475.5 11 10/21/2024
5.0.0-rc.1.20451.14 12 10/23/2024
5.0.0-preview.8.20407.11 13 10/21/2024
5.0.0-preview.7.20364.11 10 10/21/2024
5.0.0-preview.6.20305.6 9 10/23/2024
5.0.0-preview.5.20278.1 11 10/23/2024
5.0.0-preview.4.20251.6 10 10/23/2024
5.0.0-preview.3.20214.6 9 09/20/2024
3.2.1 11 10/21/2024
3.2.0 12 10/21/2024
3.2.0-rc1.20217.1 12 10/21/2024
3.2.0-preview5.20210.3 11 10/21/2024
3.2.0-preview3.20175.8 13 09/20/2024