Hi,
I'm stuck trying to return a DataSourceResult from an API and deserialize it using JSONConvert.DeserializeObject<DataSourceResult>(json)
This is what I am doing on the ASP.NET Core API side using a DataSourceRequest as input.
DataSourceResult result = await _repo.Internments.ToDataSourceResultAsync(dsRequest);
return new ContentResult() {
StatusCode = StatusCodes.Status200OK,
ContentType = "application/json",
Content = JsonConvert.SerializeObject(result, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All })
};
Then I am trying to deserialize it on the receiving end (HttpResponseMessage) in an ASP.NET Core MVC controller for use in a grid:
string funcJSON = getResponse.Content.ReadAsStringAsync().Result;
result = JsonConvert.DeserializeObject<DataSourceResult>(funcJSON, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All } );
An exception is generated when I try to deserialize it. The assembly is there. Not sure what I am doing wrong.
"Error resolving type specified in JSON 'Telerik.DataSource.DataSourceResult, Telerik.DataSource'. Path '$type', line 1, position 66."
Any help is appreciated. Thanks!