Skip to content
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

use System.Text.Json instead of Newtonsoft.Json ! #124

Open
ikourfaln opened this issue Oct 18, 2020 · 2 comments
Open

use System.Text.Json instead of Newtonsoft.Json ! #124

ikourfaln opened this issue Oct 18, 2020 · 2 comments

Comments

@ikourfaln
Copy link

Hi,

Regarding JSON serializer, I see that FaunaDB.Client is using Newtonsoft.Json !!
Check out the System.Text.Json package, I highly recommend using it, it is Fast plus it's owned and maintained by Microsoft.

Starting ASP.NET Core 3.1, System.Text.Json is the default JSON Serializer, and Newtonsoft.Json will be removed starting .NET 5.

@n400
Copy link
Contributor

n400 commented Apr 13, 2021

Thank you for this suggestion. We are working this into our roadmap, being tracked internally as DRV-531

@goncalo-oliveira
Copy link
Contributor

goncalo-oliveira commented Jul 1, 2021

Actually, it might be best if this is optional. You could use System.Text.Json by default, but you should allow to configure Newtonsoft.Json as an alternative. Microsoft's serializer has some issues, such as not supporting polymorphic deserialization (and limited serialization).

polymorphic serialization
polymorphic deserialization

Also... this comment is not exactly accurate

and Newtonsoft.Json will be removed starting .NET 5.

While Microsoft's serializer is the default (for obvious reasons), one can still use Newtonsoft.Json on ASP.NET projects. You just need to include the package Microsoft.AspNetCore.Mvc.NewtonsoftJson and when setting up the controllers on startup do this

services.AddControllers().AddNewtonsoftJson();

So... Newtonsoft's serializer isn't going anywhere just yet and much less while the polymorphic serialization issues prevail. And since that was a design decision, even less.

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

No branches or pull requests

3 participants