System.Net.Http.Json 10.0.0-rc.2.25502.107
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 
HttpContentinstances. 
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:
HttpClientJsonExtensionsHttpContentJsonExtensions
Additional Documentation
Related Packages
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 | 
|---|---|
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                43 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                40 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                39 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                38 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                35 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                34 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                33 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                32 | 
| 
                                                    OpenIddict.Client.SystemNetHttp
                                                     System.Net.Http integration package for the OpenIddict client services. 
                                                 | 
                                                32 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                31 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                30 | 
| 
                                                    Refit
                                                     The automatic type-safe REST library for Xamarin and .NET 
                                                 | 
                                                29 | 
| 
                                                    OpenIddict.Client.SystemNetHttp
                                                     System.Net.Http integration package for the OpenIddict client services. 
                                                 | 
                                                29 | 
| 
                                                    OpenIddict.Client.SystemNetHttp
                                                     System.Net.Http integration package for the OpenIddict client services. 
                                                 | 
                                                27 | 
https://go.microsoft.com/fwlink/?LinkID=799421
.NET Framework 4.6.2
- System.Text.Json (>= 10.0.0-rc.2.25502.107)
 - System.Threading.Tasks.Extensions (>= 4.6.3)
 - System.Memory (>= 4.6.3)
 - System.Buffers (>= 4.6.1)
 
.NET Standard 2.0
- System.Threading.Tasks.Extensions (>= 4.6.3)
 - System.Memory (>= 4.6.3)
 - System.Text.Json (>= 10.0.0-rc.2.25502.107)
 - System.Buffers (>= 4.6.1)
 
.NET 10.0
- No dependencies.
 
.NET 8.0
- System.Text.Json (>= 10.0.0-rc.2.25502.107)
 
.NET 9.0
- System.Text.Json (>= 10.0.0-rc.2.25502.107)