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
{{ message }}
This repository was archived by the owner on Jan 8, 2024. It is now read-only.
This library currently provides no way to configure the JSON serializer used to serialize the data. This leads to issues such as #48 / #73, and can also cause problems if you need to use a global JsonConverter rather than decorating a specific property.
For example, trying to return data from an API which includes an IPAddress property would consistently result in:
Error getting value from 'ScopeId' on 'System.Net.IPAddress'.
...
at DataTables.AspNet.Mvc5.DataTablesResponse.SerializeData(Object data)
Workaround
To resolve the problem, I created and registered a custom JsonConverter for the IDataTablesResponse object. In my base controller class, I override the Json method to use JSON.NET with my global custom converters.
ALMMa
added
bug
Decribes a bug or an invalid behavior from the library
enhancement
Describes an enhancement or an existing feature
and removed
enhancement
Describes an enhancement or an existing feature
labels
Apr 14, 2022
Problem
This library currently provides no way to configure the JSON serializer used to serialize the data. This leads to issues such as #48 / #73, and can also cause problems if you need to use a global
JsonConverter
rather than decorating a specific property.For example, trying to return data from an API which includes an
IPAddress
property would consistently result in:Workaround
To resolve the problem, I created and registered a custom
JsonConverter
for theIDataTablesResponse
object. In my base controller class, I override theJson
method to use JSON.NET with my global custom converters.DataTables.AspNet Json Configuration gist
It was then simply a case of replacing:
with:
Hopefully this might help someone else until the issue is fixed. 😊
The text was updated successfully, but these errors were encountered: