-
Notifications
You must be signed in to change notification settings - Fork 884
feat: Add System.Text.Json serialization/deserialization supports #10217
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
feat: Add System.Text.Json serialization/deserialization supports #10217
Conversation
165bb8a to
cf7bf6c
Compare
46ab297 to
cab3a99
Compare
cab3a99 to
e137e2d
Compare
e137e2d to
fed5d64
Compare
fed5d64 to
e7c8a77
Compare
e7c8a77 to
750bb7d
Compare
ae390e1 to
850625c
Compare
|
@filzrev is this PR ready for review and merge? |
|
Yes. it's ready for review. When this PR is merged and expected and released. Because of following incompatibility exists.
|
yufeih
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @filzrev . These changes looks good. There are a few conflicts need resolved before I merge.
This draft PR intended to add functionality for gradual migration from
Newtonsoft.JsontoSystem.Text.Json. (Related issue #9727)1. chore: refactoring JsonUtility code to support newtonsoftjson/systemtxtjson switching based on type (fda9353)
JsonUtilityrelated code to support switching NewtonsoftJson/SystemTextJson by type.2. chore: add json/yaml serialization test infrastructure (92a47a6)
Object->YAML->ObjectandObject->JSON->Object)3. chore: switch XRefMap serialization logics to use System.Text.Json (643c89b)
XRefMapserialization/deserialization to use JsonUtility andSystem.Text.Json.XRefMapserialization/deserialization tests.4. chore: add json roundtrip test with JsonUtility (2fa823a)
5. chore: Add MarkdigExtensionSetting json roundtrip tests (7b3dd78)
MarkdigExtensionSetting.6. chore: add ManagedReference YAML roundtrip tests (9492ef8)
ManagedReference.PageViewModelprivate initandJsonIncludeattribute(It's required because
System.Text.Jsoncan't deserialize getter-only property)7. chore: add UniversalReference YAML roundtrip tests (12c7394)
UniversalReference.PageViewModel8. chore: add ApiPage YAML roundtrip tests (448c933)
ApiPage9. chore: add FilterConfig YAML roundtrip tests (a9fde45)
FilterConfigRulegetter-only property.10. chore: Add Manifest model json roundtrip tests (9c13117)
Manifestinitproperties to support System.Text.Json deserialization.11. chore: change JavascriptEncoder settings and add related tests (9466b91)
UnsafeRelaxedJsonEscapingJSON Serialization Encoder. (By default. all non-ACSII chars are escaped)12. chore: add TOC model YAML roundtrip tests (da94915)
TOCCustomEqualityEquivalencyStepthat is used byBeEquivalentcomparison that comparing between deserialized models(Newtonsoft/SysteTextJson/YamlDotNet)CustomEqualityEquivalencyStepbehaviors13. chore: add dummy property name for deserialize metadata key data (d101fdc)
__metadata__) toMetadataproperty that usingJsonIgnoreattribute.Without this setting, SystemTextJson skip deserialization of items that have
metadatakey.(See:
https://github.com/dotnet/runtime/issues/68895)14. chore: add FileMapping/FileItems converters and JSON roundtrip tests (7b06344)
FileMapping/FileItems15. chore: disable MarkdigExtensionSettingConverter JSON formatting (8eaed9f)
MarkdigExtensionSettingConverterserialization16. chore: add ListWithStringFallback converters and JSON roundtrip test (948052a)
ListWithStringFallback17. chore: add FileMetadataPairs converters and JSON roundtrip test (6eb819c)
FileMetadataPairsEquivalentTo(NewtonsoftJson deserialize integer to
long. but SystemTextJson implementation try to deserialize asint)18. chore: add MergeJsonConfig converters and JSON roundtrip test (b8e4d85)
19. chore: add BuildJsonConfig JSON roundtrip test (80d10a7)
20. chore: add MetadataJsonConfig JSON roundtrip test (c62a025)
21. chore: add DocfxConfig JSON roundtrip test(28c55aa)
22. chore: Switch to use SystemTextJson by default and fix related tests (850625c)
23. chore: modify converter to throw JsonException if unexpected token found (f89752a)
JsonException.Future tasks (that is not handled in this PR)
RestApiRootItemViewModelserialization/deserialization to useSystem.Text.JsonJToken/JObjectKnown compatibility issues
stringtobool/numericconversion is not supported by default (e.g. "prop": "true")2.1. numeric value is deserialized as appropriate types (byte/short/long/ulong/float/double)
(NewtonsoftJson deserialize numeric value to fixed type (
longordouble) )2.2.
Dictionary<string, object>data is deserialized to object dictionary. And child array element is deserialized to List.(
NewtonsoftJsondeserialize these data toJToken)