supabase-community/supabase-csharp

Migration to System.Text.Json

heinsenberg82 opened this issue · 4 comments

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.

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!

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?

@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.