-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relational: Allow a custom serializer for JSON columns #28043
Comments
Is this still planned for release with .NET 8? |
I'd like to know as well. |
@SaifAqqad @LuohuaRain We made significant changes to the JSON infrastructure in 8, which means some additional design is now needed to expose customization of what is now already a custom serialization mechanism. |
Do you have any plans to provide an update to make an option to store Json Entity field with Non-ASCII characters without escaping it on EF Core 7? |
I think we can use it in 8. |
@shahrzadabedi Not currently. I filed #32152 to track this. |
Is it currently possible to work around the lack of this feature by using a custom converter? I understand that this suggestion is almost like not using |
I have a plugin here that implements custom serialization for the npgsql provider. It's slightly more involved than a custom converter because it also influences the SQL generation for JSON fields. |
@wjrogers the Npgsql provider's support for JSON which this affects is very different from the EF owned entity support for JSON (ToJson()) that's discussed here. For 8.0 I'm working on bringing the latter into Npgsql as well. |
Thanks Arthur |
Thank you for the clarification, Shay. |
Definitely need this - I was hoping to use built-in JSON serialization, but it's not handling badly formed data well at all (the exceptions don't even tell me where the error is!). |
Is there any temp solution for now? Like global setting, or EF uses built-in serialization? |
I got it working the way I needed using
which you can use in the OnModelCreating as needed, e.g.:
That way it honors all the attributes that normally work to control JSON serialisation (though it doesn't allow using DI-managed JsonSerializerOptions). |
I tried your solution but it didn't work. |
Didn't work in what sense? Don't have access to the codebase I was working on where I did that now but it was definitely doing the job for me. |
Related to #17306
The text was updated successfully, but these errors were encountered: