You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Move library from Newtonsoft.Json to System.Text.Json #1995
priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
Microsoft & many developers have been moving their apps & libraries from Newtsoft.Json to System.Text.Json recently (e.g. the Microsoft Graph SDK for .NET).
It would be very appreciated if this library could be moved as well. Not only is System.Text.Json faster and more efficient, it is also already used by many developers and libraries. Newtonsoft.Json isn't exactly the smallest .dll and increases the binaries of apps we are creating with the Google API Library for .NET.
This suggestion has been posted by @LindaLawton in #1464 (comment) before and I have read the discussion following on it but I was afraid that this doesn't get the visibility needed when not posted as an own feature request.
Reacted by Guillaume Lecomte, Aaron Dandy, Yegor, Andrey Stukalin, Jamie A Hankins, Ernesto Cortes Groman, Artyom Antyipin, alexeygritsenko, bartspreij, Shravan Rajinikanth and 18 more
The answer is basically the same though: it would be a breaking change, and one we basically wouldn't take unless we moved to a new major version, which is rather unlikely.
We hope to eventually removed the dependency on Google.Apis.Auth and indirectly Newtonsoft.Json for the Google.Cloud.* libraries, but even that's a long-term goal rather than anything imminent.
@jskeet I understand and respect your dedication for the new Google.Cloud.* library.
However the thing is that the Google.Apis.* library has been around a lot longer. I have personally been using it at least since 2011. This library is not going away just because there is the new shinny Google.Cloud.* library which does not support most of the discovery services apis that this library supports. We have users of this library which deserve your support and dedication as well.
As long as Microsoft continues to release new versions of .Net this library needs to and must grow with that and not become stagnant.
I would like to add if I remember correctly. There was a time when you removed support for .net 3.5 without telling the community at all. That was a huge breaking change for me personally one day it worked the next it didn't. So I don't think you should be that concerned with breaking changes. I just think that they should be voiced to the community first this time.
Reacted by Jorge Morales and Stanislav Perekrestov
changed the title [-]Move library to from Newtsoft.Json to System.Text.Json[/-][+]Move library from Newtsoft.Json to System.Text.Json[/+]on Nov 4, 2021
I don't think Json.NET is going anywhere though. Making a breaking change and releasing a new major version feels like it would be significantly disruptive. I don't think it's worth that just to remove a dependency, when we don't expect to make other significant changes.
We'll keep supporting this library and releasing new API versions, but that doesn't mean we're going to put in the large amount of effort and cause the large amount of disruption that this would cause, when the existing situation may not be ideal but works fine.
I would like to add if I remember correctly. There was a time when you removed support for .net 3.5 without telling the community at all. That was a huge breaking change for me personally one day it worked the next it didn't. So I don't think you should be that concerned with breaking changes. I just think that they should be voiced to the community first this time.
I don't remember the details of that exactly (and if we really didn't make any announcement, I regret that.). But I suspect that it only happened after .NET 3.5 itself had stopped being supported by Microsoft for a significant length of time. That's very different from making a breaking change to supported platforms. I am concerned with breaking changes, and I don't think you'll convince me that I shouldn't be.
I think we should address the detailed supported framework timelines in a separate issue, keeping this one to the Newtonsoft.Json dependency. However, I wouldn't expect to create a new major version just to remove support for frameworks that are already end-of-life by Microsoft. So if we decide to stop supporting .NET 4.5, I don't think we'd take a major bump for that. We would definitely try to make sure it's communicated well though. (I think it's more likely that we'll drop support for netstandard1.3 to be honest - but again, we'd communicate that clearly.)
In general (across GAX and Cloud libraries) we take a major version bump as an opportunity to reassess our supported platforms, but I don't think we should penalise developers who are already making sure they stay up-to-date with supported platforms by making breaking changes unless we have a really good reason to, and again I don't think the desire to drop a working dependency is a sufficient reason to create the breaking change.
Not only is System.Text.Json faster and more efficient, it is also already used by many developers and libraries. Newtonsoft.Json isn't exactly the smallest .dll and increases the binaries of apps we are creating with the Google API Library for .NET.
Already working is not a question but is it the best solution? Efficiency and size are very important IMO.
No solution is going to be perfect for everyone - but given that these libraries are in maintenance mode, I don't regard this as a critical issue.
I guess in a perfect world we'd have multiple major versions so that those who wish to stay on 1.x can do so without taking breaking changes (but still getting new API versions) and a parallel 2.x which has taken all the breaking changes we might want to. But we just don't have the resources to do that, I'm afraid.
Meanwhile, would it be acceptable to just add the [JsonPropertyName] attributes for a NET_50_OR_GREATER target?
I don't think that would be considered a breaking change but would solve my case (serialization to a jsonb column with EF Core, I do not have control on the serializer that is used).
Reacted by Linda Lawton, Chaos, Jorge Morales and Brycen G
@guillaume86: Please could you file a new issue with the details of what you're trying to achieve, and why it needs new attributes to be applied? It sounds like it's a somewhat different use case than "Please migrate off Newtonsoft.Json" in this case. (Can your serialization not just use the default property names?) There's some potential there, although we wouldn't target .NET 5 as it's not an LTS - we'd make it .NET 6.0+, if we do it at all. To set expectations, I doubt that we'll be able to put much time into even considering this until Q1 of 2022.
It's been 5 years. I don't know what is still there to be discussed. From Core to Auth, Auth to services, all Google libraries must be using System.Text.Json and AOT/Trimmable at this point. Discussing the breaking changes will not contribute to anything. Sometimes you gotta do what you gotta do and this is exactly one of those things.
I understand your frustration and I'm sorry about it. This continues to be something that we want to work on, but at the moment it's a matter of priorities, we have other, higher priority items to work through. Our intention is to start working on this sometime this year, but that's in no way a guarantee of a specific outcome or deadline.
And noting, breaking changes are still a problem here, not all users are able to move easily to newer version with significant breaking changes. We need to consider those users as well. Again, I understand how this might be frustrating, but I can't offer anything else at the moment.
This is still a complete blocker for anyone using trimming or Native AOT.
Surely this whole thing is something that can be just prototyped in an afternoon with Opus 5 or any high-tier models? 🙂
Would it be possible to bump this now that AI-assisted tooling is available and something like this would need much less effort?
@Sergio0694 a prototype, maybe, would need less effort. Shipping a product that meets all of our users needs, minimizes breaking changes etc., will not.
This is something we are working hard to prioritize but it's significant work, that spans across several different components and has the potential to break many users.
Why not create a separate package with potentially breaking changes that developers can use today, while keeping the existing package with Newtonsoft.Json for those who don’t want to take the risk?
This would allow projects that need System.Text.Json to move forward without forcing existing users to migrate. In our case, the dependency on Newtonsoft.Json prevents us from using this package in our NativeAOT application.
"a prototype, maybe, would need less effort. Shipping a product that meets all of our users needs, minimizes breaking changes etc., will not."
@amanda-tarafa of course, I wasn't saying you can just one-shot the entire actual migration. What I meant however is that (compared to over 5 years ago when the issue was first opened), surely using AI can help make a prototype to speed things up, even just go quickly get a sense for what changes would be needed, what would break, what kind of test coverage might be needed, etc.
This library is, at the moment, flat out unusable for anyone using trimming or AOT, sadly. It's not a just a minor inconvenient, that's why I was asking if using AI could perhaps at least help make progress on this faster 🙂
That said, as a side note, I did try this and got Opus 5 to literally zero-shot a complete Google Drive basic implementation using System.Text.Json, along with localhost OAuth flow, and it works just fine (sure, smaller API surface, but it's sufficient for what I need and it successfully unblocked my app). I'll just keep using this in my app until an official update that's AOT compatible is available. Maybe other folks could also do something like this as a temporary workaround.
That said, as a side note, I did try this and got Opus 5 to literally zero-shot a complete Google Drive basic implementation using System.Text.Json, along with localhost OAuth flow, and it works just fine (sure, smaller API surface, but it's sufficient for what I need and it successfully unblocked my app). I'll just keep using this in my app until an official update that's AOT compatible is available. Maybe other folks could also do something like this as a temporary workaround.
I've done the same thing for the subset of libraries required to build a BigQuery ADBC driver and have been publishing them to NuGet. See the project site for (very few) more details.
"a prototype, maybe, would need less effort. Shipping a product that meets all of our users needs, minimizes breaking changes etc., will not."
@amanda-tarafa of course, I wasn't saying you can just one-shot the entire actual migration. What I meant however is that (compared to over 5 years ago when the issue was first opened), surely using AI can help make a prototype to speed things up, even just go quickly get a sense for what changes would be needed, what would break, what kind of test coverage might be needed, etc.
This library is, at the moment, flat out unusable for anyone using trimming or AOT, sadly. It's not a just a minor inconvenient, that's why I was asking if using AI could perhaps at least help make progress on this faster 🙂
That said, as a side note, I did try this and got Opus 5 to literally zero-shot a complete Google Drive basic implementation using System.Text.Json, along with localhost OAuth flow, and it works just fine (sure, smaller API surface, but it's sufficient for what I need and it successfully unblocked my app). I'll just keep using this in my app until an official update that's AOT compatible is available. Maybe other folks could also do something like this as a temporary workaround.
Why don't you host it and give as a link so we can contribute and get this done?
Why not create a separate package with potentially breaking changes that developers can use today, while keeping the existing package with Newtonsoft.Json for those who don’t want to take the risk?
Because we cannot maintain two separate set of packages for Discovery based libraries, which are all generated btw, so we'd need to maintain two sets of support libraries and two versions of the generator, plus two versions of the Auth library.
We are trying hard to include this in the Q4-26, Q1-27 planning cycle.
priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
Activity
jskeet commentedon Nov 3, 2021
The answer is basically the same though: it would be a breaking change, and one we basically wouldn't take unless we moved to a new major version, which is rather unlikely.
We hope to eventually removed the dependency on Google.Apis.Auth and indirectly Newtonsoft.Json for the
Google.Cloud.*libraries, but even that's a long-term goal rather than anything imminent.LindaLawton commentedon Nov 4, 2021
@jskeet I understand and respect your dedication for the new Google.Cloud.* library.
However the thing is that the Google.Apis.* library has been around a lot longer. I have personally been using it at least since 2011. This library is not going away just because there is the new shinny Google.Cloud.* library which does not support most of the discovery services apis that this library supports. We have users of this library which deserve your support and dedication as well.
As long as Microsoft continues to release new versions of .Net this library needs to and must grow with that and not become stagnant.
I would like to add if I remember correctly. There was a time when you removed support for .net 3.5 without telling the community at all. That was a huge breaking change for me personally one day it worked the next it didn't. So I don't think you should be that concerned with breaking changes. I just think that they should be voiced to the community first this time.
[-]Move library to from Newtsoft.Json to System.Text.Json[/-][+]Move library from Newtsoft.Json to System.Text.Json[/+]jskeet commentedon Nov 4, 2021
I don't think Json.NET is going anywhere though. Making a breaking change and releasing a new major version feels like it would be significantly disruptive. I don't think it's worth that just to remove a dependency, when we don't expect to make other significant changes.
We'll keep supporting this library and releasing new API versions, but that doesn't mean we're going to put in the large amount of effort and cause the large amount of disruption that this would cause, when the existing situation may not be ideal but works fine.
I don't remember the details of that exactly (and if we really didn't make any announcement, I regret that.). But I suspect that it only happened after .NET 3.5 itself had stopped being supported by Microsoft for a significant length of time. That's very different from making a breaking change to supported platforms. I am concerned with breaking changes, and I don't think you'll convince me that I shouldn't be.
[-]Move library from Newtsoft.Json to System.Text.Json[/-][+]Move library from Newtonsoft.Json to System.Text.Json[/+]LindaLawton commentedon Nov 4, 2021
Well then If we follow along that train of thought and we know already that .NET Framework 4.5.2, 4.6, 4.6.1 will reach End of Support on April 26, 2022
Can we expect it to be addressed at the time we remove support for 4.5?
If so do we have a definition for "significant length of time"?
jskeet commentedon Nov 4, 2021
I think we should address the detailed supported framework timelines in a separate issue, keeping this one to the Newtonsoft.Json dependency. However, I wouldn't expect to create a new major version just to remove support for frameworks that are already end-of-life by Microsoft. So if we decide to stop supporting .NET 4.5, I don't think we'd take a major bump for that. We would definitely try to make sure it's communicated well though. (I think it's more likely that we'll drop support for netstandard1.3 to be honest - but again, we'd communicate that clearly.)
In general (across GAX and Cloud libraries) we take a major version bump as an opportunity to reassess our supported platforms, but I don't think we should penalise developers who are already making sure they stay up-to-date with supported platforms by making breaking changes unless we have a really good reason to, and again I don't think the desire to drop a working dependency is a sufficient reason to create the breaking change.
LindaLawton commentedon Nov 4, 2021
Already working is not a question but is it the best solution? Efficiency and size are very important IMO.
jskeet commentedon Nov 4, 2021
No solution is going to be perfect for everyone - but given that these libraries are in maintenance mode, I don't regard this as a critical issue.
I guess in a perfect world we'd have multiple major versions so that those who wish to stay on 1.x can do so without taking breaking changes (but still getting new API versions) and a parallel 2.x which has taken all the breaking changes we might want to. But we just don't have the resources to do that, I'm afraid.
LindaLawton commentedon Nov 4, 2021
As always we appreciate everything you and the team do. Maintaining an OS project is a thankless job. Let me take the time to Thank you.
Please keep us updated on this.
guillaume86 commentedon Nov 17, 2021
Meanwhile, would it be acceptable to just add the [JsonPropertyName] attributes for a NET_50_OR_GREATER target?
I don't think that would be considered a breaking change but would solve my case (serialization to a jsonb column with EF Core, I do not have control on the serializer that is used).
jskeet commentedon Nov 18, 2021
@guillaume86: Please could you file a new issue with the details of what you're trying to achieve, and why it needs new attributes to be applied? It sounds like it's a somewhat different use case than "Please migrate off Newtonsoft.Json" in this case. (Can your serialization not just use the default property names?) There's some potential there, although we wouldn't target .NET 5 as it's not an LTS - we'd make it .NET 6.0+, if we do it at all. To set expectations, I doubt that we'll be able to put much time into even considering this until Q1 of 2022.
guillaumejay commentedon Dec 10, 2021
I think it's a real issue, because #1983 is alive on AzureDevops, and breaks CI/CD.
8 remaining items
bkaankose commentedon Apr 6, 2026
It's been 5 years. I don't know what is still there to be discussed. From Core to Auth, Auth to services, all Google libraries must be using System.Text.Json and AOT/Trimmable at this point. Discussing the breaking changes will not contribute to anything. Sometimes you gotta do what you gotta do and this is exactly one of those things.
amanda-tarafa commentedon Apr 6, 2026
I understand your frustration and I'm sorry about it. This continues to be something that we want to work on, but at the moment it's a matter of priorities, we have other, higher priority items to work through. Our intention is to start working on this sometime this year, but that's in no way a guarantee of a specific outcome or deadline.
And noting, breaking changes are still a problem here, not all users are able to move easily to newer version with significant breaking changes. We need to consider those users as well. Again, I understand how this might be frustrating, but I can't offer anything else at the moment.
Tiktack commentedon Jun 8, 2026
@amanda-tarafa Hi, any updates on this? It should be higher priority in 2026 than p3...
amanda-tarafa commentedon Jun 8, 2026
No update at the moment. Still on our backlog.
Sergio0694 commentedon Aug 21, 2026
This is still a complete blocker for anyone using trimming or Native AOT.
Surely this whole thing is something that can be just prototyped in an afternoon with Opus 5 or any high-tier models? 🙂
Would it be possible to bump this now that AI-assisted tooling is available and something like this would need much less effort?
amanda-tarafa commentedon Aug 21, 2026
@Sergio0694 a prototype, maybe, would need less effort. Shipping a product that meets all of our users needs, minimizes breaking changes etc., will not.
This is something we are working hard to prioritize but it's significant work, that spans across several different components and has the potential to break many users.
ekalchev commentedon Aug 31, 2026
Why not create a separate package with potentially breaking changes that developers can use today, while keeping the existing package with Newtonsoft.Json for those who don’t want to take the risk?
This would allow projects that need System.Text.Json to move forward without forcing existing users to migrate. In our case, the dependency on Newtonsoft.Json prevents us from using this package in our NativeAOT application.
Please give us an option.
ekalchev commentedon Aug 31, 2026
They are not allowed to use anything other than Gemini at Google, so i guess that could be the reason it is not done yet 😄
Sergio0694 commentedon Aug 31, 2026
@amanda-tarafa of course, I wasn't saying you can just one-shot the entire actual migration. What I meant however is that (compared to over 5 years ago when the issue was first opened), surely using AI can help make a prototype to speed things up, even just go quickly get a sense for what changes would be needed, what would break, what kind of test coverage might be needed, etc.
This library is, at the moment, flat out unusable for anyone using trimming or AOT, sadly. It's not a just a minor inconvenient, that's why I was asking if using AI could perhaps at least help make progress on this faster 🙂
That said, as a side note, I did try this and got Opus 5 to literally zero-shot a complete Google Drive basic implementation using System.Text.Json, along with localhost OAuth flow, and it works just fine (sure, smaller API surface, but it's sufficient for what I need and it successfully unblocked my app). I'll just keep using this in my app until an official update that's AOT compatible is available. Maybe other folks could also do something like this as a temporary workaround.
CurtHagenlocher commentedon Aug 31, 2026
I've done the same thing for the subset of libraries required to build a BigQuery ADBC driver and have been publishing them to NuGet. See the project site for (very few) more details.
ekalchev commentedon Aug 31, 2026
Why don't you host it and give as a link so we can contribute and get this done?
ekalchev commentedon Sep 1, 2026
I found this, in case it might be useful to someone: https://github.com/clast-project/google-api-dotnet-client
amanda-tarafa commentedon Sep 1, 2026
Because we cannot maintain two separate set of packages for Discovery based libraries, which are all generated btw, so we'd need to maintain two sets of support libraries and two versions of the generator, plus two versions of the Auth library.
We are trying hard to include this in the Q4-26, Q1-27 planning cycle.