When you call AddNewtonsoftJson on a particular method:
services.AddRazorPages().AddNewtonsoftJson();
...is the scope limited to RazorPages (in this example), or does it affect the entire pipeline, equivalent (as far as JSON.NET is concerned) to calling
services.AddMvc().AddNewtonsoftJson();
I ask because some third-party libraries use JSON.NET still but my project doesn't (in this case Coravel Pro, which also uses RazorPages which my application also doesn't), and I'm concerned about potential conflicts.
Hopefully this is an appropriate place to ask this question; if not please feel free to redirect me. Thanks.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@Tratcher 30 second question
@pranavkm
Razor Pages and MVC have the same underpinnings. If you reference a library that calls AddNewtonsoftJson on your behalf, it will also affect controllers (and other MVC features) in your app.
Within MVC, it changes the following things to use Json.Net:
cc @serpent5 if you're interested in updating this doc.
Thank you, that answered my question precisely. I would close this but I'll defer to @serpent5 in case he wants to clarify this in the doc. If not, feel free to close. Thanks again.
I'm happy to do something here. How about adding a "for more information" link in this migration topic to the Add Newtonsoft.Json-based JSON format support section in "Format response data in ASP.NET Core Web API" and including some of Pranav's information in that section?
@serpent5 that would be great.