How to deserialize stream to object using System.Text.Json APIs
问题 I'm receiving a response from a web api call as a stream and need to deserialize it to a model. This is a generic method, so I can't say which parts of code will use this and what's the response payload. Here's the method: public async Task<T> InvokeAsync<T>(string method) { Stream response = await this.httpClientWrapper.InvokeAsync(method); var serializer = new JsonSerializer(); using var streamReader = new StreamReader(response); using var reader = new JsonTextReader(streamReader); return