refactor(json): migrate serialization from Newtonsoft to System.Text.Json (#349)#351
Open
wrigjl wants to merge 1 commit into
Open
refactor(json): migrate serialization from Newtonsoft to System.Text.Json (#349)#351wrigjl wants to merge 1 commit into
wrigjl wants to merge 1 commit into
Conversation
…Json (ReduxISU#349) The info and problemInstance endpoints were the last Newtonsoft.Json users. Replace JsonConvert.SerializeObject with JsonSerializer.Serialize, passing the runtime type explicitly so System.Text.Json emits the concrete object's members rather than an empty {} for the object/IProblem declared type. Enable IncludeFields to reproduce Newtonsoft's default of serializing public fields (e.g. ARCSET.K, UtilCollectionGraph.Nodes/Edges); verified endpoint output is structurally identical to the prior behavior. Drop the Newtonsoft.Json package references from API and redux-tests, and remove an unused Newtonsoft.Json.Linq import from the MST tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #349.
Summary
Removes the last uses of Newtonsoft.Json from the API so all JSON serialization goes through
System.Text.Json.The only remaining Newtonsoft consumers were the
infoandproblemInstanceendpoints inProblemProvider.cs. TheAPI_JSON_Converterreferenced in the issue was already aSystem.Text.Jsonconverter and needed no changes.Changes
JsonConvert.SerializeObject(...)withJsonSerializer.Serialize(...)in theinfoandproblemInstanceendpoints, passing the runtime type explicitly so STJ emits the concrete object's members instead of an empty{}for theobject/IProblemdeclared type.IncludeFields = truefor those endpoints to reproduce Newtonsoft's default of serializing public fields (e.g.ARCSET.K,UtilCollectionGraph.Nodes/Edges).Newtonsoft.Jsonpackage references fromAPI.csprojandredux-tests.csproj.Newtonsoft.Json.Linqimport from the MST tests.Validation
infoandproblemInstanceoutput for CLIQUE, ARCSET, HITTINGSET, SAT3, plus a verifier, solver, and visualization, before and after the change. An order-independent structural JSON diff shows identical output — no client contract change.dotnet build: clean (0 warnings).dotnet test: 678 passed, 0 failed.🤖 Generated with Claude Code