Allow to set the JSON Serializer to DateTimeOffset
See original GitHub issueIs your feature request related to a problem? Please describe.
I want to store my Date Time values in a DateTimeOffset
. I have a place where is it convent to get the JObject
from the cosmos DB and work with the DateTimeOffset
. I found no easy way to set Json parser to DateTimeOffset
.
(in v2 I had
serializerSettings: new JsonSerializerSettings
{
DateParseHandling = DateParseHandling.DateTimeOffset
}
)
Describe the solution you’d like I want to configure this in a similar way as in v2 of the sdk:
.WithSerializerOptions(new CosmosSerializationOptions
{
DateParseHandling = DateParseHandling.DateTimeOffset
}
Describe alternatives you’ve considered I think I need to write a custom class like: https://gist.github.com/richstokoe/c82fc831c6b4020926f5b5f772f7cd70
Additional context #551 Add support for JSON.net JsonSerializerSettings #650 Enabling serialization customization through CosmosSerializerOptions
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
DateTime and DateTimeOffset support in System.Text.Json
For serializing, you can use the DateTime(Offset).ToString method in your converter write logic. This method allows you to write DateTime and ...
Read more >Json.Net messes up timezones for DateTimeOffset when ...
1 Answer 1 · Serializing an instance of Class2 to a JSON string using specific DateTime -related serialization settings. · Deserializing to a ......
Read more >System.Text.Json DateTime & DateTimeOffset “\/Date ...
Part of the series: Fun with System.Text.Json. I was working on porting some code to .NET Core that has to call a whole...
Read more >Serializing Dates in JSON
DateTimes in JSON are hard. The problem comes from the JSON spec itself: there is no literal syntax for dates in JSON. The...
Read more >DateTimeZoneHandling setting
This sample uses the T:Newtonsoft.Json.DateTimeZoneHandling setting to control how T:System.DateTime and T:System.DateTimeOffset are serialized.
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
No, I use one like https://gist.github.com/richstokoe/c82fc831c6b4020926f5b5f772f7cd70
We don’t currently have a time frame. We are working towards becoming complaint with the Azure SDK for NET repo.