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

[Breaking change]: System.Text.Json will replace Newtonsoft.Json in Umbraco 14 #9

Open
2 tasks done
bergmania opened this issue Jan 10, 2023 · 2 comments
Open
2 tasks done
Labels
category/binary-incompatible Existing binaries may encounter a breaking change in behavior. category/breaking category/source-incompatible Source code may encounter a breaking change in behavior when targeting the new version. cms/release/14.0.0

Comments

@bergmania
Copy link
Member

bergmania commented Jan 10, 2023

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

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • 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

@Nuklon
Copy link

Nuklon commented Mar 16, 2023

I assume this will include Umbraco Forms? As that also uses it.

@dampee
Copy link

dampee commented Mar 24, 2023

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

@lassefredslund lassefredslund changed the title [Breaking change]: System.Text.Json will replace Newtonsoft.Json in Umbraco 13 [Breaking change]: System.Text.Json will replace Newtonsoft.Json in Umbraco 14 Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/binary-incompatible Existing binaries may encounter a breaking change in behavior. category/breaking category/source-incompatible Source code may encounter a breaking change in behavior when targeting the new version. cms/release/14.0.0
Projects
None yet
Development

No branches or pull requests

4 participants