Skip to content

StackExchange.Utils.Http.Extensions.System.Text.Json is a library that extends StackExchange.Utils.Http allowing you to use System.Text.Json Json deserializer instead of JIL

License

Notifications You must be signed in to change notification settings

TraceParts/StackExchange.Utils.Http.Extensions.System.Text.Json

Repository files navigation

StackExchange.Utils.Http.Extensions.System.Text.Json

Currently StackExchange.Utils.Http has dependency on Jil for Json serialization and deserialization.

This package allows to use System.Text.Json instead of JIL

StackExchange.Utils.Http.Extensions.System.Text.Json

How to use it

var result = await Http.Request("https://example.com")  
                       .SendSystemTextJson(new { name = "my thing" })
                       .ExpectSystemTextJson<MyType>(MyJsonSerializerSettings)
                       .GetAsync()

If serializerSettings is null, JsonSerializer will use default settings from DefaultSettings.

Of course, you can use all other features from StackExchange, like this:

var result = await Http.Request("https://example.com")
                       .IgnoredResponseStatuses(HttpStatusCode.NotFound)
                       .WithTimeout(TimeSpan.FromSeconds(20))
                       .SendSystemTextJson(new { name = "my thing" })
                       .ExpectSystemTextJson<MyType>()
                       .GetAsync();

About

StackExchange.Utils.Http.Extensions.System.Text.Json is a library that extends StackExchange.Utils.Http allowing you to use System.Text.Json Json deserializer instead of JIL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages