[Breaking change]: `System.Text.Json` will replace `Newtonsoft.Json` in Umbraco 14
Description
Newtonsoft.Json will be replaced by System.Text.Json and the dependency on Newtonsoft.Json will be removed in version 14.
Version
Umbraco 14
Previous behavior
Newtonsoft.Json was used to serialize and deserialze to and from JSON. Umbraco had a dependency on Newtonsoft.Json.
New behavior
System.Text.Json is used to serialize and deserialze to and from JSON. Umbraco has a dependency on System.Text.Json.
Type of breaking change
- [X] Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
- [X] Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.
Reason for change
System.Text.Json is the default serialization library in ASP.NET Core.
The performance of System.Text.Json compared to Newtonsoft.Json is desired. System.Text.Json focuses primarily on performance, security, and standards compliance. It has some key differences in default behavior and doesn't aim to have feature parity with Newtonsoft.Json.
Recommended action
Use the Umbraco IJsonSerializer interface along side standard serialization attributes, instead of taking dependencies directly on Newtonsoft.Json
If you need some features only in Newtonsoft.Json you will need to take a dependency yourself.
Affected APIs
N/A
I assume this will include Umbraco Forms? As that also uses it.
As long as you still allow to inject other inputFormatters, it's all good. The issue is that System.Text.Json does not support HttpPatch yet. see https://learn.microsoft.com/en-us/aspnet/core/web-api/jsonpatch?view=aspnetcore-7.0#add-support-for-json-patch-when-using-systemtextjson