Skip to content

Conversation

@drualcman
Copy link

Updated JSHandler<TItem> to improve JSON deserialization by introducing JsonSerializerOptions with custom settings and a new NullToDefaultIntConverter. Refactored methods to use JsonElement for JavaScript interop callbacks, enhancing robustness and flexibility in handling JSON data. Removed unnecessary using directives for cleaner code.

Updated `JSHandler<TItem>` to improve JSON deserialization by introducing `JsonSerializerOptions` with custom settings and a new `NullToDefaultIntConverter`. Refactored methods to use `JsonElement` for JavaScript interop callbacks, enhancing robustness and flexibility in handling JSON data. Removed unnecessary `using` directives for cleaner code.
@joadan
Copy link
Collaborator

joadan commented Oct 31, 2025

Hi,

Thank you for this, however I'm not sure this is is the best way to handle this is issue.
We have control of the source of the json and it feels like we should try to fix it there.

I will take a closer look at the issue and take it from there.

@drualcman
Copy link
Author

Hi @joadan

Thanks to have a look. Yes, if you can fix how JS send then no need to change nothing into c# code.

I am using in production and the issue is that, from JS some times send null values where is expecting a number, or send a string when expecting a number, then can't auto deserialize.

That's why, after have a look from c# side I can manage, this is the only way I found to fixed it. So I implement in all the methods, to do same kind of work and deserialization in all methods.

The issue I detected is onClick and onHover. But while I am cheking the code, I feel much better do same in all methods.

Thanks again, and waiting for your news.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants