-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyThis issue is related to and / or impacts Blazor WebAssembly
Description
Describe the bug
httpClient.GetJsonAsync is unable to parse JSON downloaded from API that contain null value
To Reproduce
@shipList
@code
{
private List<Ship> shipList;
HttpClient httpClient = new HttpClient() { BaseAddress = new Uri("https://api.spacexdata.com") };
protected override async Task OnInitializedAsync()
{
shipList = await httpClient.GetJsonAsync<List<Ship>>("/v3/ships");
}
Error value
InvalidOperationException: Cannot get the value of a token type 'Null' as a number.
Further technical details
- ASP.NET Core version 3.0
PS
I've tried setting addJsonOptions in Startup.cs (https://stackoverflow.com/questions/44595027/net-core-remove-null-fields-from-api-json-response ) but it didn't work.
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyThis issue is related to and / or impacts Blazor WebAssembly