Using c# 8 and .netcore 3.1.
I've read HERE that Utf8Json library process json serialization and deserialization faster that NewtonsoftJson.
We've recently upgraded our servers code from .netcore 2.2 to 3.1 mostly for performance improvements. Thus, it is reasonable that we also use the best serialization library.
So my questions are:
In
Startup.cs
there is thisservices.AddControllers().AddNewtonsoftJson(options => { options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); });
And I want it to use a different library, so I found out that I can use .AddJsonOptions
but I cannot figure out how to set default serializer, even after using my google-fu skills.
- Since I've been using
[JsonProperty("<name>")]
everywhere in my code in order to reduce json string size, do I need to format everything for the new serializer or is there a way to make him consider the property attribute ? (attribute is Newtonsoft)
Thanks.