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

Upgrade to Orchard Core 1.9 once it's released and remove Newtonsoft.Json from the code base (OCC-194) #362

Open
sarahelsaig opened this issue Oct 2, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@sarahelsaig
Copy link
Contributor

sarahelsaig commented Oct 2, 2023

Orchard Core 1.9 will finally migrate to System.Text.Json and drop Newtonsoft.Json support. This much anticipated event should be followed up in Orchard Core Commerce as well.

Blocking:


Obsolete description:

Is your feature request related to a problem? Please describe

Currently OCC has serialization via Newtonsoft Json.NET and System.Text.Json. Both are actually used in different places. This makes things unnecessarily complicated as serializers have to be implemented in two different frameworks.

Describe the solution you'd like

Orchard Core still uses Json.NET at the core of its content system (see) and so do many other third party modules and libraries that build on OC. While the OC team has expressed intent to eventually switch over to STJ, this is not in the near future. Additionally based on previous comments (for example here) we might want to rewrite the STJ implementation from scratch if this ever happens.
In the meantime, we should do the following to make the code more maintainable and approachable:

  • Remove the STJ converters
  • If possible, rename the Json.NET converters without the "Legacy" prefix. (if OC ever changes over to STJ we will delete these converters anyway so I don't expect that we should ever have two different sets.
  • Partially rewrite ShoppingCartSerializer, IProductAttributeProvider and any other file where using System.Text.Json; is found to use Json.NET instead.

Describe alternatives you've considered

Alternatively we may fully commit to STJ-only, but I think at this point this would be premature, an enormous technical debt and a source of future headaches.

Jira issue

@sarahelsaig sarahelsaig added the enhancement New feature or request label Oct 2, 2023
@github-actions github-actions bot changed the title Remove System.Text.Json from the code base Remove System.Text.Json from the code base (OCC-194) Oct 2, 2023
@hishamco
Copy link
Member

hishamco commented Oct 3, 2023

Orchard Core is still using Newtonsoft Json.NET because of YesSQL but for sure if all the JSON stuff is implemented in STJ then the STJ wins

IMHO we could use STJ all over places if all agree

I might have a look to related issue in YesSQL to use STJ

@sarahelsaig
Copy link
Contributor Author

Is there an open issue tracking the transition from Json.NET to STJ in Orchard Core? I can't find one, that's the main reason why I assumed it's off in the far future. I found an open YesSql issue for moving to STJ (sebastienros/yessql#227), but it hasn't been touched since 2020.

If we can get the move to STJ started for YesSQL and OC then I'm all for it (and would like to get involved). But if it will be stuck in limbo for much longer then I'd still prefer to cut down on duplicate code in the meantime.

@hishamco
Copy link
Member

hishamco commented Oct 3, 2023

I might check that issue again, so for now I think we can go with STJ if you don't mind or we will rid off STJ until we finish all the things in YesSQL

@sarahelsaig sarahelsaig changed the title Remove System.Text.Json from the code base (OCC-194) Upgrade to Orchard Core 1.9 once it's released and remove Newtonsoft.Json from the code base (OCC-194) Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants