Repository navigation
Document byte array deserialization differences between Newtonsoft.Json and System.Text.Json (Fixes #41394) - #56654
Open
Manish-1kumar wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The converter changes byte-array serialization from Base64 to numeric arrays, risking consumer compatibility; it should preserve Base64 output while broadening deserialization.
1 open issue
What changed in this PR
Extends the System.Text.Json migration guide to address #41394 by explaining how byte-array deserialization differs from Newtonsoft.Json.
Changes:
- Adds a differences-table entry linked to a new Byte arrays section.
- Documents default Base64 serialization and differing support for numeric-array input.
- Provides a custom converter example that accepts both input formats.
| File | Description |
|---|---|
docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md |
Adds byte-array migration guidance, a converter example, and an updated content date. |
Review effort: Balanced
…on and System.Text.Json Fixes dotnet#41394
Manish-1kumar
force-pushed
the
users/manish/issue-41394-byte-array-serialization
branch
from
November 30, 2026 17:53
cf40d4e to
08e83cc
Compare
BillWagner
reviewed
Dec 1, 2026
BillWagner
left a comment
Member
There was a problem hiding this comment.
This is a good start @Manish-1kumar
I have one major comment to address.
|
|
||
| To deserialize a JSON number array into a `byte[]` with `System.Text.Json`, use a custom converter: | ||
|
|
||
| ```csharp |
Member
There was a problem hiding this comment.
This sample is significant enough, it should be in a snippet and under our CI system. I'd also like the sample to run some output to verify correctness.
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.

Description
Resolves #41394.
In \docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md, documents behavioral differences between \Newtonsoft.Json\ and \System.Text.Json\ when deserializing \�yte[].\
Changes Included
Internal previews
Build report