JsonSerializationException on ColumnChart

Hi all,

I have a page with a chart. The first time I open the page everything works without problems. But as soon as I switch to another page and then come back to the page with the chart, I get many error messages that look like posted below. What can I do?

Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Syncfusion.Blazor.Charts.ChartSeries]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'zOrder', line 1, position 10.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Syncfusion.Blazor.Internal.SfBaseUtils.ChangeType(Object dataValue, Type conversionType, Boolean isClientChange)
   at Syncfusion.Blazor.BaseComponent.UpdateCollectionValue(Object propertyValue, Type propertyType, Nullable`1 sfIndex, Object model, Boolean isAutoInitialized)
   at Syncfusion.Blazor.BaseComponent.UpdateComponentModel(Dictionary`2 properties, BaseComponent parentObject, Boolean isAutoInitialized)
   at Syncfusion.Blazor.BaseComponent.UpdateModel(Dictionary`2 properties)
Error: Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Syncfusion.Blazor.Charts.ChartSeries]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'zOrder', line 1, position 10.

3 Replies 1 reply marked as answer

SM Srihari Muthukaruppan Syncfusion Team December 2, 2020 08:58 AM UTC

Hi Florian, 
 
We have analysed your query. Based on that we have tried navigating through link and sidebar between pages and its working fine in latest version 18.3.52. Unfortunately we are unable to reproduce the reported scenario. We have also attached the sample used for testing for your reference. Please find the sample and screenshot below. 
 
 
Screenshot: 
Before Navigation: 
 
 
After Navigation: 
 
 
 
If you still face this issue. kindly revert us with the following information which will be more helpful for further analysis and provide you the solution sooner.  
  
  1. Try to reproduce the reported scenario in the provided sample.  
  2. Please share the nugget version used in the sample.
 
Regards,   
Srihari 


Marked as answer

SI Shrewd Infotech May 18, 2023 08:58 AM UTC

You have used static data but i want to bind it dynamically and i have created ODATA endpoint for that but still it giving me error like


unhandled exception rendering component: the json value could not be converted to system.collections.generic.list`1[system.object]. this come when i used sfchart component



GV Gopalakrishnan Veeraraghavan Syncfusion Team May 19, 2023 11:57 AM UTC

Hi Florian,


We have analyzed your query and are attempting to reproduce the issue on our end by retrieving the data source remotely and quickly switching between chart pages. Each page rendered the chart with remote data. However, we have been unable to replicate the issue in the latest version. Therefore, we do not have information about the version. Please provide a sample or code snippet as it will be helpful for us to provide a solution sooner. We have attached a sample and a video for your reference.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/NavigatePages_1376106183.zip


Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/NAVIGA~2-2021417064.zip


Kindly revert us if you have any concerns.


Regards,

Gopalakrishnan Veeraraghavan


Loader.
Up arrow icon