Comments (10)
@tuscen
I found the following information regarding your question.
TLDR: yes.
But here is a quote and a link.
The System.Text.Json library is included in the runtime for .NET Core 3.1 and later versions. For other target frameworks, install > the System.Text.Json NuGet package. The package supports:
• .NET Standard 2.0 and later versions
• .NET Framework 4.7.2 and later versions
• .NET Core 2.0, 2.1, and 2.2
And here is the link:
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft?pivots=dotnet-8-0
from telegram.bot.
@cyrmax wow, what a great idea! How would you approach this transformation with the existing codebase?
from telegram.bot.
Will this work for netstandard2.0
targets? Old runtimes that support it is still widely used and we can't stop supporting it yet.
from telegram.bot.
@cyrmax Thanks, we'll probably try to migrate to source generated converters then
from telegram.bot.
@karb0f0s
If you mean that it is impossible or too difficult then please explain why.
I didn't looked at the code yet but I think at least it is possible and reasonable.
from telegram.bot.
@cyrmax By the way, you really don't want this library to be trimmed since it's an API client. What will it do in case your bot receives an object that should be deserialized to a type that was trimmed during compilation?
from telegram.bot.
@cyrmax Do you have experience with STJ source generators? I’ve tried to use it in this library, but for some reason it doesn’t generate converters. But in a separate test project I don’t have any problems.
from telegram.bot.
@tuscen I will try to investigate this on weekend. In my projects this feature works just fine too. I will see.
from telegram.bot.
I've managed to generate json converters, but I struggle to understand how to make it work in .NET 6 in such a way that one could augment existing JsonSerializerOptions
instead of completely rewriting existing ones. This is a deal breaker since we can't impose our own instance of JsonSerializerOptions
on clients using webhooks since they might have their own conventions in their ASP.NET Core apps. It seems .NET 8 have a solution for this using JsonTypeInfoResolver.Combine
which .NET 6 lacks. If you have ideas on how to workaround please tell me. Otherwise I don't think we will be able to use STJ until .NET 6 is EOL so we could target the library to .NET 8 instead of .NET 6.
from telegram.bot.
I've managed to generate json converters, but I struggle to understand how to make it work in .NET 6 in such a way that one could augment existing
JsonSerializerOptions
instead of completely rewriting existing ones. This is a deal breaker since we can't impose our own instance ofJsonSerializerOptions
on clients using webhooks since they might have their own conventions in their ASP.NET Core apps. It seems .NET 8 have a solution for this usingJsonTypeInfoResolver.Combine
which .NET 6 lacks. If you have ideas on how to workaround please tell me. Otherwise I don't think we will be able to use STJ until .NET 6 is EOL so we could target the library to .NET 8 instead of .NET 6.
https://www.planetgeek.ch/2022/10/15/using-system-text-json-alongside-newtonsoft-json-net/
In this article author shows how to use System.Text.Json alongside Newtonsoft.
And also he shows how it's possible to change serializer options for endpoints marked with special attribute (file SystemTextJsonBodyModelBinder.cs
lines 10-11)
Maybe it would be useful for further research.
from telegram.bot.
Related Issues (20)
- updateHandler is not invoked asynchronously HOT 2
- Bot API 6.8 (August 18, 2023)
- Missing documentation InputOnlineFile => InputFileUrl HOT 3
- Bot API 6.9 (September 22, 2023)
- Could we have InputMediaBase inherit from IAlbumInputMedia? HOT 3
- Erro não autorizado HOT 2
- Bug Report - Lack of Graceful Shutdown in Message Updates Handling HOT 4
- Release 19.0.1 HOT 3
- Bot API 7.0 (December 29, 2023)
- Calling MakeRequestAsync with Stream content more then once results in error HOT 2
- Looks like this source generator is completely non incremental HOT 3
- telegram.bot is missing NuGet package README file
- Telegram.Bot.dll PUA classification with ESET problem HOT 5
- Send v20.0.0-alpha.3 to nuget plz HOT 1
- Project is not compatible with net8.0 (.NETCoreApp,Version=v8.0) HOT 7
- System.Text.Json deserialization issue HOT 5
- Temporary alternative NuGet feed due to AV software false positives
- GetStickerSetAsync() fails: Required property 'is_animated' not found in JSON HOT 2
- Required property 'is_animated' not found in JSON HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telegram.bot.