Skip to content

Migrate from Newtonsoft to System.Text.Json#156

Open
EmaX093 wants to merge 2 commits intohydrostack:mainfrom
EmaX093:system-text-json
Open

Migrate from Newtonsoft to System.Text.Json#156
EmaX093 wants to merge 2 commits intohydrostack:mainfrom
EmaX093:system-text-json

Conversation

@EmaX093
Copy link
Copy Markdown

@EmaX093 EmaX093 commented May 4, 2026

WARNING: Needs thorough testing. It works perfectly on my end, but we should look out for potential edge cases

This pull request migrates the codebase from using Newtonsoft.Json to the built-in System.Text.Json for JSON serialization and deserialization throughout the project. It updates serializer settings, replaces all usages of JsonConvert and related types with their System.Text.Json equivalents, and adjusts code to accommodate API differences. This change reduces external dependencies and leverages the improved performance and features of System.Text.Json.

Migration from Newtonsoft.Json to System.Text.Json:

  • All references to Newtonsoft.Json and JsonConvert have been replaced with System.Text.Json and JsonSerializer, including serializer settings and attributes such as [JsonProperty] to [JsonPropertyName].
  • The Newtonsoft.Json package reference was removed from the project.
  • Serializer options and settings updates
  • Code and API adjustments
  • Utility classes and extension methods have been updated to use the new serialization APIs and settings.

This migration streamlines JSON handling in the project, aligns with modern .NET practices, and removes a third-party dependency.

@kjeske
Copy link
Copy Markdown
Contributor

kjeske commented May 4, 2026

Thank you for the PR!

I see the biggest challange was the JsonPopulate. I think replacing well tested version from Newtonsoft would require writing comprehensive unit tests - without it we cannot be sure the new version works well in all the scenarios.

@EmaX093
Copy link
Copy Markdown
Author

EmaX093 commented May 4, 2026

Totally agree! Wrote a json utility to mimic netwonsoft PopulateObject implementation (see JsonPopulator class), but it needs a comprensive set of testing to be sure it doesn't break something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants