In version 3.0.0-preview6.19307.2 the GetJsonAsync extension method returns an empty object
Steps to reproduce the behavior:
var response = await _httpClient.GetJsonAsync<SomeComplexeGenericType<SomeType>>("http://api")Before version '3.0.0-preview6.19307.2' the object was successfully deserialized
I can workaround with :
var message = await _client.GetAsync("http://api");
var content = await message.Content.ReadAsStringAsync();
var response = JsonSerializer.Parse<SomeComplexeGenericType<SomeType>>(content);
The JsonSerializer is case insensitive here and assumes camel case. We should change it to be case insensitive for deserialization. cc @rynowak
This is already fixed!
How do I get this fix for all my calls? Do I need to wait till preview 7?
Yes @tsmccartan. this will be part of preview 7 release.
@tsmccartan You, can also add `[JsonPropertyName("Id")] to all properties in serializable class, this can help with solving issue now.
Most helpful comment
The JsonSerializer is case insensitive here and assumes camel case. We should change it to be case insensitive for deserialization. cc @rynowak