Open
Description
Description
Implementing a custom converter for a Dictionary<string, object> is used to serialize JsonExtensionData properties but there is no way for the converter to know if it is serializing an extension property or a dictionary property. Because of that invalid JSON is generated.
Reproduction Steps
See fiddle: https://dotnetfiddle.net/VIrtyu
Expected behavior
The custom converter should have a way to check if the current write operation value is json extension data.
{"RegularData":{"World":"Hello"},"Hello":"World"}
Actual behavior
The custom converter does not know if it json extension data and therefore writes an object instead of weaving the properties into the parent.
{"RegularData":{"World":"Hello"},{"Hello":"World"}}
Regression?
No response
Known Workarounds
No response
Configuration
.NET 5, System.Text.Json 5.0.2
Other information
Might be related to #32903