You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are getting below error in BaseService.cs file but getting data properly in JSON.
Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'LSI.Web.Models.ResponseDto' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.'
var apiRespnseDto = JsonConvert.DeserializeObject(apiContent); (Error Line)
The text was updated successfully, but these errors were encountered:
## YOU SHOULD TRY THIS WAY ##
===================================
apiResponse = await client.SendAsync(message);
var apiContent = await apiResponse.Content.ReadAsStringAsync();
var res = new ResponseMessegeBO
{
Result = apiContent
};
var response = JsonConvert.SerializeObject(res);
var apiResponseDto = JsonConvert.DeserializeObject<T>(response);
return apiResponseDto ;
Hi @bhrugen,
We are getting below error in BaseService.cs file but getting data properly in JSON.
var apiRespnseDto = JsonConvert.DeserializeObject(apiContent); (Error Line)
The text was updated successfully, but these errors were encountered: