Fix object type deserialization to preserve concrete types#537
Closed
YunchuWang with Copilot wants to merge 5 commits into
Closed
Fix object type deserialization to preserve concrete types#537YunchuWang with Copilot wants to merge 5 commits into
YunchuWang with Copilot wants to merge 5 commits into
Conversation
…tring, object> Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix activity input handling for complex types
Fix Dictionary<string, object> activity inputs deserializing as JsonElement
Dec 7, 2025
Member
|
@copilot not just ditionary, we need to correctly deserialize any custom types customer call with |
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Contributor
Author
The
The converter applies whenever JSON is deserialized to |
Copilot
AI
changed the title
Fix Dictionary<string, object> activity inputs deserializing as JsonElement
Fix object type deserialization to preserve concrete types
Dec 7, 2025
Member
|
@copilot resolve merge conflict |
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Contributor
Author
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.
Fix Activity Input with Complex Types Ending Up as JSON Elements
This PR fixes an issue where complex types in
Dictionary<string, object>and otherobject-typed fields were being deserialized asJsonElementinstead of their original types.Root Cause
System.Text.Json deserializes
objecttypes asJsonElementby default because it doesn't know what concrete type to use.Solution
Added a custom
ObjectToInferredTypesConverterthat infers appropriate .NET types based on JSON token types:stringint,long, ordoubleboolDictionary<string, object>object[]nullThe converter is registered for the
objecttype, so it applies to all scenarios whereobjectis used:Dictionary<string, object>valuesobjectfields in custom classesobject[]arraysobjecttypeChanges Made
ObjectToInferredTypesConverter.cswith proper type inference logicJsonDataConverter.csto use the new converter in default optionsobjectfieldsobject[]arraysTesting
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.