supabase-community / supabase-csharp

A C# Client library for Supabase
https://github.com/supabase-community/supabase-csharp/wiki
MIT License
495 stars 50 forks source link

Migration to System.Text.Json #96

Open heinsenberg82 opened 1 year ago

heinsenberg82 commented 1 year ago

I think it would be really great to migrate from Newtonsoft.Json to System.Text.Json. The latter is more performant than the former, in addition to being the library officially maintained by Microsoft.

If the creators are interested, I can try to help by working on this change and making a pull request.

acupofjose commented 1 year ago

I'm open to it! I don't believe it's a trivial migration however, especially in the realtime-csharp and postgrest-csharp repos, there are some Newtonsoft specific implementations that would need to be converted. But if you're willing to open a PR, please do!

wiverson commented 1 year ago

FWIW Unity also has a (slightly different) hacked up version of Newtonsoft (because of course) https://docs.unity3d.com/Packages/com.unity.nuget.newtonsoft-json@3.2/manual/index.html

I was able to get postgrest etc working using the Unity Newtonsoft instead and it seems they are binary compat. Out of curiosity do you happen to recall what was Newtonsoft specific? Guessing it's more than a call to serialize/deserialize?

acupofjose commented 1 year ago

@wiverson sure!

For Postgrest: its the PostgrestContractResolver.cs and the Converters.

For Realtime: its the CustomContractResolver and the Converters.

Outside of those, everything should transfer pretty easily. But they are (obviously) all tied to core functionality.

PATRICKdallat commented 7 months ago

Would love to see this migration.