question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow to set the JSON Serializer to DateTimeOffset

See original GitHub issue

Is 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:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
j82wcommented, Oct 9, 2019

We don’t currently have a time frame. We are working towards becoming complaint with the Azure SDK for NET repo.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found