Add DictionaryKeyPolicy to CosmosSerializationOptions
See original GitHub issueSystem.Text.Json
allows consumers to specify a different naming policy for dictionary keys than for regular properties.
This is supported via a DictionaryKeyPolicy property on JsonSerializerOptions
.
A similar capability should be provided for the out-of-the-box Cosmos serializer without having to implementing a custom serializer.
Issue Analytics
- State:
- Created 5 months ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Untitled
Add DictionaryKeyPolicy to CosmosSerializationOptions #3810 ... WebApr 27, 2022 · You could also make a JsonSerializerOptions singleton and add that to DI: ...
Read more >JsonSerializerOptions.DictionaryKeyPolicy Property
Gets or sets the policy used to convert a IDictionary key's name to another format, such as camel-casing.
Read more >CosmosClientOptions.Serializer Property
The client will use it to serialize or de-serialize user's cosmos request/responses. SDK owned types such as DatabaseProperties and ContainerProperties will ...
Read more >Untitled
bsod_ Aug 24, 2018 at 21:31 Add a comment 1 Answer Sorted by: 8 Option 1 Even though Widget is ... To do...
Read more >c# - System.Text.Json.JsonSerializer ignores ...
This is a known bug in .NET Core 3.x that has been fixed in .NET 5. See: System.Text.Json: DictionaryKeyPolicy not applied to keys...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see two paths:
CosmosSerializationOptions
to apply the NamingPolicy to Dictionaries. The problem is mixing the boolean with a NamingPolicy that would not apply (like Default).CosmosPropertyNamingPolicy
, likeCamelCaseOnlyProperties
. This approach makes sure we set the flag in theCamelCasePropertyNamesContractResolver
tofalse
.I’ll mark this as feature request to be tracked.
Yes, that is right. I want to be able to configure it so that dictionary keys pass through unchanged, regardless of the property naming strategy.