supabase-csharp icon indicating copy to clipboard operation
supabase-csharp copied to clipboard

Migration to System.Text.Json

Open heinsenberg82 opened this issue 1 year ago • 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.

heinsenberg82 avatar Aug 23 '23 19:08 heinsenberg82

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!

acupofjose avatar Aug 23 '23 19:08 acupofjose

FWIW Unity also has a (slightly different) hacked up version of Newtonsoft (because of course) https://docs.unity3d.com/Packages/[email protected]/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 avatar Aug 23 '23 19:08 wiverson

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

acupofjose avatar Aug 23 '23 19:08 acupofjose

Would love to see this migration.

PATRICKdallat avatar Apr 04 '24 07:04 PATRICKdallat