-
Notifications
You must be signed in to change notification settings - Fork 200
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
Replace Newtonsoft.Json with System.Text.Json #206
Comments
I'd like to make the case against entirely relying on System.Text.Json. While working on stored procedure work, I came across the need to support more customized deserialization from strings to enums. Json converters like Kebab casing and workarounds like specifying with the EnumMember attribute aren't natively supported by .NET. This issue describes what I'm referring to in detail. From the developers working on this issue: dotnet/runtime#29975 (comment)
Others echo this sentiment throughout the issue. Point being - I don't think we should remove Newtonsoft if it is serving a valid purpose in our code, as System.Text.Json isn't necessarily meant to be an all-encompassing solution, it seems. |
There might be some use cases where changing over doesn't really get us much, if anything, and STJ is missing features which would make doing so overly burdensome. However, the performance differences between the two are large enough that even if using STJ in a particular case is difficult to do, we should aspire to do so anyway. And in particular for those areas where perf testing shows that we get a significant speed up in runtime, or significant drop in memory allocation by using STJ, in my opinion, we should do whatever we can to make that work. |
@Aniruddh25, does this cover Cosmos as well? |
Did a bit of research/trial, came across some articles which suggest System.Text.Json might not be very ready to replace for every feature that Newtonsoft provides. One of them is on the json object comparison front. There has been a github issue filed for the same here as well: dotnet/runtime#33388 and another one here: dotnet/runtime#56592 |
While I see substitutes of |
As indicated by the articles linked above, there is no out of the box mechanism provided by system.text.json library as of now to compare two json objects semantically. However, issues are raised already on github to provide such features. We can write our own custom comparator though, but for now, as per discussion with @Aniruddh25, we have decided to keep things as is. I see |
Duplicate of #60 |
With it built into the .NET framework, there's probably no need to rely on an external package for serialisation/deserialisation of the JSON is there?
The text was updated successfully, but these errors were encountered: