Let me know if I'm doing something wrong here. I'm creating a Web Service to service my Web Application through a REST API. One class of methods I'm exposing provides the view models that feed into Kendo UI controls, like the grid. I'm trying to separate the concerns of the client and server by passing the paging parameters to the service and, when the service has completed the query and reduced the results down to a specific number of items (page size) on a given page (page #), I attempt to return the results to the client using the following:
DataSourceResult dataSourceResult = investments.ToDataSourceResult<InvestmentViewModel>(dataSourceRequest);
dataSourceResult.Total = total;
return Json(dataSourceResult);
On the client, I attempt to deserialize this data with:
//Deserializing the response recieved from web api and storing into the Employee list
dataSourceResult = JsonConvert.DeserializeObject<DataSourceResult>(result);
But I get an error message:
Newtonsoft.Json.JsonSerializationException: 'Cannot create and populate list type System.Collections.IEnumerable. Path 'data', line 1, position 9.'
What is the proper way to deserialize the DataSourceResult JSON?