I found some information about nuget package - Newtonsoft: Json.NET
As far I know it makes serialization from JSON to C# object much faster.
My question: Is it enough to install this package to my ASP.NET CORE WebAPI project or I have bind it somehow, dunno maybe with middleware or something? And it will makes serialization faster?
ASP.NET Core MVC features that use Newtonsoft. Json. Includes input and output formatters for JSON and JSON PATCH. Learn more about Target Frameworks and .
Thanks. Json.NET vs Newtonsoft. Json are the same thing. You must be trying to use the same code with different versions of Json.NET.
Text. Json is much faster than the Newtonsoft. Json.
The Newtonsoft. JSON namespace provides classes that are used to implement the core services of the framework. It provides methods for converting between . NET types and JSON types.
You don't need to do anything special to get Newtonsoft.JSON to work. Simply install it through NuGet (or manually) and you're good to go. You will however have to go through your code and replace any code you wrote to work with JSON before installing it.
EDIT: You dont even have to do that! Turns out .Net Core uses it out of the box. Refer to this answer for how to use it natively.
UPDATE: From the answer linked above:
This is only true for ASP.NET Core 1.0 to 2.2. ASP.NET Core 3.0 removes the dependency on JSON.NET and uses it's own JSON serializer.
As for performance, there are a few benchmarks out there that compare alternative ways of serializing and deserializing JSON. A quick google search led me to this, as well as this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With