skip to Main Content

How to set a JsonSerializerOptions globally for my httpClient.GetFromJsonAsync<T> calls

In my ASP.NET web API I have httpClient which call GetFromJsonAsync: var jsonSerializerOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, }; jsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); await httpClient.GetFromJsonAsync<Item[]>(uri, jsonSerializerOptions); It is quite repetitive to add the jsonSerializerOptions parameter in all my GetFromJsonAsync calls…

VIEW QUESTION
Back To Top
Search