You need to await the task like so:
var result = await response.Content.ReadAsStringAsync(); Danger of using var, as now it inferred the type as Task<string>. If you had tried: string result = response.Content.ReadAsStringAsync(); It would have immediately given you an error that it can't cast Task<string> to string. EDIT: The other error you have is that you are trying to deserialize the JSON into an object when it is actually an array. List<BusinessUnit> businessunits = JsonConvert.DeserializeObject<List<BusinessUnit>>(result); Get c# object list from response.Content.ReadAsStringAsync() How can i get the name of property and value from object and pass this name and value to a list in c# Get list of object from a form in .net core data binding Get controller and action name from AuthorizationHandlerContext object Get Hub Context in SignalR Core from within another object Why does a property get initialized to a null instead of an empty list from configuration? asp.net core 1.0 mvc. Get raw content from Request.Body score:2 You could try this: IEnumerable<BusinessUnit> result = await response.Content.ReadAsAsync<IEnumerable<BusinessUnit>>(); Saludos. Related Query Google drive Redirect URI Mismatch and how to get files list from google drive in ASP.net core 2.0 Get a specific response header (e.g., Content-Disposition) in React from an ASP.NET CORE Web Api Get ErrorMessage from Response in Netcore 2.2 Web API How can i get List of users from Azure AD? remove object from list and return as object .net core How to deserialize a JSON response to an object list How to pass list of class object in get method - asp.net core 2.1 Get HTML Content string from Taghelper How to get rolename from Roles object in asp.net core HttpClient response messege "The operation was canceled.". The json result in postman is [ ]? How to get all data from API Angular7 - Get Response from the API Call get JSON object using jquery with ajax call from controller to view How to get typed response object in IActionFilter. ASP Core 2.2 Can´t get response in angular from asp.net core web api Call .net core controller get method with an object from angular2 How do I get a list of strings from an observable.Subscribe function Get Response Header data from Post Call JWT: How to get a List of Values from a specific Key in the Claims. C# Asp.Net Core How to get all secrets from Azure Key Vault and then load into configuration object using ASP.Net Core How can I get one property from a large JSON object in .net core? How to get key list from razor engine template in c#? Add extension method to IQueryable which paginates list and returns json object when returned from a API Controller method How to get object from ViewComponent on post? How to get cookie value from response using angular How to get product row from each order of child table list using Entity Framework Core? How can we pass XML as request to .Net core API and get response in XML from Same API in c#? .Net Core Get json result from another controller action and convert the json string into c# object Get full object from collection in API request fail How to get string response from generic asyn method How to get Item Price after Selection from select2 Dropdown list in dot net I send list of files from .net5 mvc project to .net5 api, but get only one file instead of the list of files Filtering or removing array objects from the DTO class object based on an another list in .net How to get content from a view throught another view with asp.net core? ASP.NET Core, Ajax call for Delete does not reload div content in Index page(PartialView) from html json response Get an object from a service to allow test to run using xUnit and Moq ASP.net core how to return result list from a get statement Object object error, when trying to get a specific attribute from my Model Easiest way to find Unique object from a list of object Read Json from response and convert it to Json Object How to bind list of object from razor code behind to Kendo chart in cshtml object self destruction from list C# capitalize when get a response from redis cache Entity Framework Core C# : I have a problem with a object in an List object I include in my generated Get statement More Query from same tag AddSigningCredential in IdentityServer4 - Self-signed or from a certificate authority ASP.NET Core 5 web app running on Linux - run ssh commands as different user to www-data perform authorization check in code behind How to bind the selected item from a select list to if condition in razor view Is it possible to migrate asp.net web application to asp.net core mvc, How to fix Obj Folder Assembly Error: "Executables cannot be satellite assemblies; culture should always be empty" Generating random int with specific condition C# How to get the parameter values of a Controller Action in an Exception Filter - ASP.NET Core C# Simplify null check condition Angular 2 http.post is not sending parameters as null in Dot.Net Core Store a RsaSecurityKey in DB ef core 2 - code first - access to view How to do dependency injection on a noncontroller in asp.net core? .Net Core Context ServiceLifetime types Use body stream parameter in WebApi controller's action Entity Framework MultiTenant Per User Error when controller route is referenced Problem with connecting to REST Api by HTTPS from Xamarin forms - Android phone Set IHostingEnvironment.IsDevelopment() to true in VS Code on OSX TempData - "object reference not set to an instance of an object" when refreshing the page Unable to access local css file IdentityServer4 + Web Api + Spa together in one project How to append meta data to Web Api response Sign MS PowerPoint macros in ASP.NET Core Can't post (create) 3rd level nested model in ASP.NET Core 3.1 MVC Ajax.ActionLink alternative with mvc core How to generate an entity model from a query w/ EntityFrameworkCore Unified MVC Controller Routing in Asp.Net 5 ASP.NET CORE - Online Shop Order As Guest / Anonymous User Copy text directly to clipboard in asp.net
Danger of using var, as now it inferred the type as Task<string>. If you had tried:
var
Task<string>
string result = response.Content.ReadAsStringAsync(); It would have immediately given you an error that it can't cast Task<string> to string. EDIT: The other error you have is that you are trying to deserialize the JSON into an object when it is actually an array. List<BusinessUnit> businessunits = JsonConvert.DeserializeObject<List<BusinessUnit>>(result); Get c# object list from response.Content.ReadAsStringAsync() How can i get the name of property and value from object and pass this name and value to a list in c# Get list of object from a form in .net core data binding Get controller and action name from AuthorizationHandlerContext object Get Hub Context in SignalR Core from within another object Why does a property get initialized to a null instead of an empty list from configuration? asp.net core 1.0 mvc. Get raw content from Request.Body score:2 You could try this: IEnumerable<BusinessUnit> result = await response.Content.ReadAsAsync<IEnumerable<BusinessUnit>>(); Saludos. Related Query Google drive Redirect URI Mismatch and how to get files list from google drive in ASP.net core 2.0 Get a specific response header (e.g., Content-Disposition) in React from an ASP.NET CORE Web Api Get ErrorMessage from Response in Netcore 2.2 Web API How can i get List of users from Azure AD? remove object from list and return as object .net core How to deserialize a JSON response to an object list How to pass list of class object in get method - asp.net core 2.1 Get HTML Content string from Taghelper How to get rolename from Roles object in asp.net core HttpClient response messege "The operation was canceled.". The json result in postman is [ ]? How to get all data from API Angular7 - Get Response from the API Call get JSON object using jquery with ajax call from controller to view How to get typed response object in IActionFilter. ASP Core 2.2 Can´t get response in angular from asp.net core web api Call .net core controller get method with an object from angular2 How do I get a list of strings from an observable.Subscribe function Get Response Header data from Post Call JWT: How to get a List of Values from a specific Key in the Claims. C# Asp.Net Core How to get all secrets from Azure Key Vault and then load into configuration object using ASP.Net Core How can I get one property from a large JSON object in .net core? How to get key list from razor engine template in c#? Add extension method to IQueryable which paginates list and returns json object when returned from a API Controller method How to get object from ViewComponent on post? How to get cookie value from response using angular How to get product row from each order of child table list using Entity Framework Core? How can we pass XML as request to .Net core API and get response in XML from Same API in c#? .Net Core Get json result from another controller action and convert the json string into c# object Get full object from collection in API request fail How to get string response from generic asyn method How to get Item Price after Selection from select2 Dropdown list in dot net I send list of files from .net5 mvc project to .net5 api, but get only one file instead of the list of files Filtering or removing array objects from the DTO class object based on an another list in .net How to get content from a view throught another view with asp.net core? ASP.NET Core, Ajax call for Delete does not reload div content in Index page(PartialView) from html json response Get an object from a service to allow test to run using xUnit and Moq ASP.net core how to return result list from a get statement Object object error, when trying to get a specific attribute from my Model Easiest way to find Unique object from a list of object Read Json from response and convert it to Json Object How to bind list of object from razor code behind to Kendo chart in cshtml object self destruction from list C# capitalize when get a response from redis cache Entity Framework Core C# : I have a problem with a object in an List object I include in my generated Get statement More Query from same tag AddSigningCredential in IdentityServer4 - Self-signed or from a certificate authority ASP.NET Core 5 web app running on Linux - run ssh commands as different user to www-data perform authorization check in code behind How to bind the selected item from a select list to if condition in razor view Is it possible to migrate asp.net web application to asp.net core mvc, How to fix Obj Folder Assembly Error: "Executables cannot be satellite assemblies; culture should always be empty" Generating random int with specific condition C# How to get the parameter values of a Controller Action in an Exception Filter - ASP.NET Core C# Simplify null check condition Angular 2 http.post is not sending parameters as null in Dot.Net Core Store a RsaSecurityKey in DB ef core 2 - code first - access to view How to do dependency injection on a noncontroller in asp.net core? .Net Core Context ServiceLifetime types Use body stream parameter in WebApi controller's action Entity Framework MultiTenant Per User Error when controller route is referenced Problem with connecting to REST Api by HTTPS from Xamarin forms - Android phone Set IHostingEnvironment.IsDevelopment() to true in VS Code on OSX TempData - "object reference not set to an instance of an object" when refreshing the page Unable to access local css file IdentityServer4 + Web Api + Spa together in one project How to append meta data to Web Api response Sign MS PowerPoint macros in ASP.NET Core Can't post (create) 3rd level nested model in ASP.NET Core 3.1 MVC Ajax.ActionLink alternative with mvc core How to generate an entity model from a query w/ EntityFrameworkCore Unified MVC Controller Routing in Asp.Net 5 ASP.NET CORE - Online Shop Order As Guest / Anonymous User Copy text directly to clipboard in asp.net
It would have immediately given you an error that it can't cast Task<string> to string.
string
EDIT: The other error you have is that you are trying to deserialize the JSON into an object when it is actually an array.
List<BusinessUnit> businessunits = JsonConvert.DeserializeObject<List<BusinessUnit>>(result); Get c# object list from response.Content.ReadAsStringAsync() How can i get the name of property and value from object and pass this name and value to a list in c# Get list of object from a form in .net core data binding Get controller and action name from AuthorizationHandlerContext object Get Hub Context in SignalR Core from within another object Why does a property get initialized to a null instead of an empty list from configuration? asp.net core 1.0 mvc. Get raw content from Request.Body score:2 You could try this: IEnumerable<BusinessUnit> result = await response.Content.ReadAsAsync<IEnumerable<BusinessUnit>>(); Saludos. Related Query Google drive Redirect URI Mismatch and how to get files list from google drive in ASP.net core 2.0 Get a specific response header (e.g., Content-Disposition) in React from an ASP.NET CORE Web Api Get ErrorMessage from Response in Netcore 2.2 Web API How can i get List of users from Azure AD? remove object from list and return as object .net core How to deserialize a JSON response to an object list How to pass list of class object in get method - asp.net core 2.1 Get HTML Content string from Taghelper How to get rolename from Roles object in asp.net core HttpClient response messege "The operation was canceled.". The json result in postman is [ ]? How to get all data from API Angular7 - Get Response from the API Call get JSON object using jquery with ajax call from controller to view How to get typed response object in IActionFilter. ASP Core 2.2 Can´t get response in angular from asp.net core web api Call .net core controller get method with an object from angular2 How do I get a list of strings from an observable.Subscribe function Get Response Header data from Post Call JWT: How to get a List of Values from a specific Key in the Claims. C# Asp.Net Core How to get all secrets from Azure Key Vault and then load into configuration object using ASP.Net Core How can I get one property from a large JSON object in .net core? How to get key list from razor engine template in c#? Add extension method to IQueryable which paginates list and returns json object when returned from a API Controller method How to get object from ViewComponent on post? How to get cookie value from response using angular How to get product row from each order of child table list using Entity Framework Core? How can we pass XML as request to .Net core API and get response in XML from Same API in c#? .Net Core Get json result from another controller action and convert the json string into c# object Get full object from collection in API request fail How to get string response from generic asyn method How to get Item Price after Selection from select2 Dropdown list in dot net I send list of files from .net5 mvc project to .net5 api, but get only one file instead of the list of files Filtering or removing array objects from the DTO class object based on an another list in .net How to get content from a view throught another view with asp.net core? ASP.NET Core, Ajax call for Delete does not reload div content in Index page(PartialView) from html json response Get an object from a service to allow test to run using xUnit and Moq ASP.net core how to return result list from a get statement Object object error, when trying to get a specific attribute from my Model Easiest way to find Unique object from a list of object Read Json from response and convert it to Json Object How to bind list of object from razor code behind to Kendo chart in cshtml object self destruction from list C# capitalize when get a response from redis cache Entity Framework Core C# : I have a problem with a object in an List object I include in my generated Get statement More Query from same tag AddSigningCredential in IdentityServer4 - Self-signed or from a certificate authority ASP.NET Core 5 web app running on Linux - run ssh commands as different user to www-data perform authorization check in code behind How to bind the selected item from a select list to if condition in razor view Is it possible to migrate asp.net web application to asp.net core mvc, How to fix Obj Folder Assembly Error: "Executables cannot be satellite assemblies; culture should always be empty" Generating random int with specific condition C# How to get the parameter values of a Controller Action in an Exception Filter - ASP.NET Core C# Simplify null check condition Angular 2 http.post is not sending parameters as null in Dot.Net Core Store a RsaSecurityKey in DB ef core 2 - code first - access to view How to do dependency injection on a noncontroller in asp.net core? .Net Core Context ServiceLifetime types Use body stream parameter in WebApi controller's action Entity Framework MultiTenant Per User Error when controller route is referenced Problem with connecting to REST Api by HTTPS from Xamarin forms - Android phone Set IHostingEnvironment.IsDevelopment() to true in VS Code on OSX TempData - "object reference not set to an instance of an object" when refreshing the page Unable to access local css file IdentityServer4 + Web Api + Spa together in one project How to append meta data to Web Api response Sign MS PowerPoint macros in ASP.NET Core Can't post (create) 3rd level nested model in ASP.NET Core 3.1 MVC Ajax.ActionLink alternative with mvc core How to generate an entity model from a query w/ EntityFrameworkCore Unified MVC Controller Routing in Asp.Net 5 ASP.NET CORE - Online Shop Order As Guest / Anonymous User Copy text directly to clipboard in asp.net
You could try this:
IEnumerable<BusinessUnit> result = await response.Content.ReadAsAsync<IEnumerable<BusinessUnit>>(); Saludos. Related Query Google drive Redirect URI Mismatch and how to get files list from google drive in ASP.net core 2.0 Get a specific response header (e.g., Content-Disposition) in React from an ASP.NET CORE Web Api Get ErrorMessage from Response in Netcore 2.2 Web API How can i get List of users from Azure AD? remove object from list and return as object .net core How to deserialize a JSON response to an object list How to pass list of class object in get method - asp.net core 2.1 Get HTML Content string from Taghelper How to get rolename from Roles object in asp.net core HttpClient response messege "The operation was canceled.". The json result in postman is [ ]? How to get all data from API Angular7 - Get Response from the API Call get JSON object using jquery with ajax call from controller to view How to get typed response object in IActionFilter. ASP Core 2.2 Can´t get response in angular from asp.net core web api Call .net core controller get method with an object from angular2 How do I get a list of strings from an observable.Subscribe function Get Response Header data from Post Call JWT: How to get a List of Values from a specific Key in the Claims. C# Asp.Net Core How to get all secrets from Azure Key Vault and then load into configuration object using ASP.Net Core How can I get one property from a large JSON object in .net core? How to get key list from razor engine template in c#? Add extension method to IQueryable which paginates list and returns json object when returned from a API Controller method How to get object from ViewComponent on post? How to get cookie value from response using angular How to get product row from each order of child table list using Entity Framework Core? How can we pass XML as request to .Net core API and get response in XML from Same API in c#? .Net Core Get json result from another controller action and convert the json string into c# object Get full object from collection in API request fail How to get string response from generic asyn method How to get Item Price after Selection from select2 Dropdown list in dot net I send list of files from .net5 mvc project to .net5 api, but get only one file instead of the list of files Filtering or removing array objects from the DTO class object based on an another list in .net How to get content from a view throught another view with asp.net core? ASP.NET Core, Ajax call for Delete does not reload div content in Index page(PartialView) from html json response Get an object from a service to allow test to run using xUnit and Moq ASP.net core how to return result list from a get statement Object object error, when trying to get a specific attribute from my Model Easiest way to find Unique object from a list of object Read Json from response and convert it to Json Object How to bind list of object from razor code behind to Kendo chart in cshtml object self destruction from list C# capitalize when get a response from redis cache Entity Framework Core C# : I have a problem with a object in an List object I include in my generated Get statement More Query from same tag AddSigningCredential in IdentityServer4 - Self-signed or from a certificate authority ASP.NET Core 5 web app running on Linux - run ssh commands as different user to www-data perform authorization check in code behind How to bind the selected item from a select list to if condition in razor view Is it possible to migrate asp.net web application to asp.net core mvc, How to fix Obj Folder Assembly Error: "Executables cannot be satellite assemblies; culture should always be empty" Generating random int with specific condition C# How to get the parameter values of a Controller Action in an Exception Filter - ASP.NET Core C# Simplify null check condition Angular 2 http.post is not sending parameters as null in Dot.Net Core Store a RsaSecurityKey in DB ef core 2 - code first - access to view How to do dependency injection on a noncontroller in asp.net core? .Net Core Context ServiceLifetime types Use body stream parameter in WebApi controller's action Entity Framework MultiTenant Per User Error when controller route is referenced Problem with connecting to REST Api by HTTPS from Xamarin forms - Android phone Set IHostingEnvironment.IsDevelopment() to true in VS Code on OSX TempData - "object reference not set to an instance of an object" when refreshing the page Unable to access local css file IdentityServer4 + Web Api + Spa together in one project How to append meta data to Web Api response Sign MS PowerPoint macros in ASP.NET Core Can't post (create) 3rd level nested model in ASP.NET Core 3.1 MVC Ajax.ActionLink alternative with mvc core How to generate an entity model from a query w/ EntityFrameworkCore Unified MVC Controller Routing in Asp.Net 5 ASP.NET CORE - Online Shop Order As Guest / Anonymous User Copy text directly to clipboard in asp.net
Saludos.