DEV Community

loading...

Discussion on: Consuming third-party APIs in ASP.NET Core

Collapse
nikolicbojan profile image
Bojan Nikolić

Hi Jeremy,
Could I suggest not using response.Content.ReadAsStringAsync() and then serializing to object? It will impact the memory usage and depending on a response size, it can introduce also allocations on large-object-heap.
There is a new NuGet, provided by Microsoft, that makes working with JSON very smooth - System.Net.Http.Json.
You can read on some applications on Steve Gordon's blog post stevejgordon.co.uk/sending-and-rec...

Thank you for this nice series of articles!

Collapse
jsheridanwells profile image
Jeremy Wells Author

Thanks for point that out, Bojan. The article you shared described the problem well. I made the change and it's working as expected so I'll update the article shortly.

Collapse
nikolicbojan profile image
Bojan Nikolić

Glad if I helped :)