-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Accessing the property information changes the order of System.Text.Json serialization. #33854
Labels
Milestone
Comments
Dotnet-GitSync-Bot
added
area-System.Text.Json
untriaged
New issue has not been triaged by the area owner
labels
Mar 20, 2020
Reflection order is not guaranteed on serialization. The serialized content will always be the same. |
It will be used to save application settings, but there is a problem if the order is not guaranteed.
Is JsonSerializer.Serialize not suitable for this purpose? |
To fix the order, we propose the following enhancements:
|
I will look closely at that issue. |
ghost
locked as resolved and limited conversation to collaborators
Dec 10, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If you access the property information before serialization, the property will be output at the top.
I hope the same serialized result is output from the same object regardless of the property access.
Sample code
Result: .NET Core 3.1
The accessed property "C" is placed at the top.
Result: .NET Framework 4.8 + System.Text.Json 4.7.1
In the .NET Framework, the order changes from the second time.
The text was updated successfully, but these errors were encountered: